Beispiel #1
0
            public void SyncSetting()
            {
                var json = JsonUtility.ToJson(this);

                if (NetworkServer.active)
                {
                    NetworkMessageManager.SendNetworkMessageToAll(LoadSettingFromJson, NetworkMessageManager.GetStringMessage(json));
                }
            }
Beispiel #2
0
            void SyncSettingToClient(NetworkConnection conn)
            {
                var json = JsonUtility.ToJson(this);

                NetworkMessageManager.SendNetworkMessage(conn, LoadSettingFromJson, NetworkMessageManager.GetStringMessage(json));
            }
Beispiel #3
0
 public void SetSyncable()
 {
     sync = true;
     NetworkMessageManager.AddHandler(LoadSettingFromJson);
     NetworkManager.Instance.onServerConnect.AddListener(SyncSettingToClient);
 }