Like i said, if this is a MonoBehavior, check in the editor on the object you have it attached to. The editor value overrides the value you put in code.
He was saying that maybe you changed the value of it to something other than 2, in the editor. Because the value in the editor will always override the value in the script.
That is the script. I copied the code and paste it.
I created a local variable and set it to zero. It seems that even though the editor says test is 2 it is actual zero.
It now spawn with the code below.
var test : int = 2;
OnNetworkLoadlevel()
{
var oner : int = 0;
if(test == oner)
{
Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
}
}
What’s probably happening is that, since test is a public variable, the value of test in the Unity Inspector (Not in the code) is set to 0. When you go to your Unity project, and click on the game object that has the script attached to it, you should see the value of the test variable in the Inspector. The value there is probably set to zero, which overrides the value you have in code.