void Start() { string connectMsg = MessageConnect.serialize(ObjectManager.identity); string msg = MessageModelMapper.serialize(MessageConnect.TYPE_NAME, connectMsg); NetworkManager.sendMessage(msg); ObjectManager.syncObject(); }
public static void syncObject() // synchronize local objects { //Debug.Log("Sync " + localObjDict.Count); foreach (KeyValuePair <string, NetworkObject> kv in localObjDict) { string objStateArgs = kv.Value.getStateArgs(); string msgSpawn = MessageSpawn.serialize(identity, kv.Key, kv.Value.prefabClassName, objStateArgs); string msg = MessageModelMapper.serialize(MessageSpawn.TYPE_NAME, msgSpawn); // send msg //Debug.Log("Sync obj: " + msg); NetworkManager.sendMessage(msg); } }