Networking sync enabled state?


I have figured out how to sync position and rotation, but I was wondering how to synchronize the enabled/disbled state of an object?

Thanks in advance,


You can do it like that (untested but should work):

    public bool objEnabled;

    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
		if (stream.isWriting)
			//print ("writing");
		    stream.Serialize(ref objEnabled);
			//print ("reading");
            bool tmpEnabled = false;
			stream.Serialize(ref tmpEnabled );
            objEnabled = tmpEnabled;

Put that in a script and put it on the same gameobject as your NetworkView component.