- Home /
Question by
Deadly Firefly · Oct 29, 2013 at 07:59 PM ·
instantiatenetworkreference
Can't reference network instantiated Game Object
Hey,
here's my question. Why am I not able to reference the player? The Debug.Log gives me: "The Player: "
GameObject player = Network.Instantiate(chosenClass, blueSpawn.transform.position,
blueSpawn.transform.rotation, 0) as GameObject;
Debug.Log("The player: " + player);
PlayerScript pScript = player.GetComponent<PlayerScript>();
pScript.blueTeam = true;
Comment
I dont know why that is happening, maybe you should make it public then check the inspector, also don't instantiated classes, send a RPC toggling objects to make the classes, and $$anonymous$$ms should be a int or string, not a bool(those two issues are just me though).