For example I’m gonna make a choice at “Choice.js”
public static var playerInt : int;
var playTypeString : String;
function Start()
{
playerInt = 0;
}
function Update () {
if(playerInt == 0) {
playTypeString = "sphere";
} else if(playerInt == 1) {
playTypeString = "stick";
} else if(playerInt == 2) {
playTypeString = "plus";
}
var text = gameObject.GetComponent(TextMesh);
text.text = playTypeString.ToString();
}
At there I’ve set public static variable. I want to get it’s value at Game Scene and i use this;
function Start () {
if(Choice.playerInt == "0" ){
Debug.Log("player1");
}
if(Choice.playerInt == "1" ){
Debug.Log("player2");
}
}
But didn’t work.