Network.Instantiate duplicates inputs from the client, so that input from either will control the player on the other.
Yes, I know, I can turn this off when the object is instantiated, but the unity reference seems to imply this shouldnt be necessary:
http://docs.unity3d.com/Documentation/Components/net-NetworkInstantiate.html
" The instantiating client is the one that controls the object (ie, the Input class is only accessible from scripts running on the client instance) but changes will be reflected across the network."
This isn’t even the first time the official documentation seems to have been wrong or misleading. According to this, I shoudn’t have to manually disable the input scripts on the remote objects.
I should mention that even doing the manual check doesn’t seem to be working.
This code is on the prefab FPS, which includes a networkView and a camera that is disabled by default:
function OnNetworkInstantiate( info:NetworkMessageInfo ):void {
Debug.Log( "instantiate: " + info.sender );
if ( networkView.isMine == false ) {
Debug.Log( "Not my object" );
GetComponent( MouseLook ).enabled = false;
GetComponent( FPSInputController ).enabled = false;
} else {
Debug.Log( "this is my object." );
var cam:Camera = gameObject.Find( "Main Camera" ).GetComponent( Camera );
cam.enabled = true;
//cam.GetComponent( AudioListener ).enabled = false;
} //
enabled = false;
} //
One network instantiate is called on the server, one on the client, but both are laying claim to the same object.
They both think they own only one of the instances.
I figured it out and it took awhile. The gameObject.Find() is not a gameObject function but a class function. What you need to use to find a child object is the gameObject.transform.Find()
gameObject.Find() works at the scene level.