/// <summary> ///called after entity deserialize. If you do NOT call this, your state will not be applied ///This also spawns an object if the object we received state data for doesn't exist. /// </summary> public void ProcessEntityMessage(int prefabId, int networkId, int owner, int controller, params object[] args) { NetworkEntity entity = null; entity = GetEntity(owner, networkId); if (entity != null) { entity.OnEntityUpdate(args); entity.controller = controller; } else { //this entity doesn't exist for some reason. Maybe it has already been destroyed locally //anyways, since we already read from the stream, we can just discard whatever we read //without issues to the next messages we read. //OR we should spawn it, then pass it the data entity = Core.net.SpawnPrefabInternal(prefabId, networkId, owner, controller, args).GetComponent <NetworkEntity>(); entity.OnEntityUpdate(args); entity.controller = controller; } //don't need to process, just call onEntityUpdate with our new values //Core.net.MessageProcessors[msgCode](sender, prefabId, networkId, owner, controller); }