Hello! I’m trying to modify a static var contained in a javascript script from a C# script - given to the same gameobject - but i get an error. The problem seem to be the syntax. This is my C# code:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
public void SetCheckBoxValue(string myCheckBoxVal)
{
if (myCheckBoxVal == "true"){
gameObject.GetComponent("GameControllerScript").gameMode = 1;
}
if (myCheckBoxVal == "false"){
gameObject.GetComponent("GameControllerScript").gameMode = 2;
}
}
}
The error i get is “Type “UnityEngine.Component” does not contain a definition for “gameMode” and no extension method “gameMode” of type “UnityEngine.Component” could be found (are you missing a using directive or an assembly reference?)”