Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

Scene objects are not reset after disconnecting

Open imerr opened this issue 4 years ago • 3 comments

Describe the bug When disconnecting & reconnecting to a server as a client without reloading the scene, the state of scene network objects is not reset. This might lead to syncvar hooks not firing since the syncvar is still the same. I'm not sure if this qualifies as a bug or is worth fixing, just something I stumbled upon

How to reproduce the issue, step by step Add SyncVar to networked scene object

        [SyncVar(hook = nameof(BlaChanged))]
        public string bla = 0;
        void BlaChanged(string old, string bla)
        {
            Debug.LogError($"{gameObject.name} - Changed from {old} to {bla}");
        }
  1. Leave at default value, connect client, no SyncVar hook fires ✅
  2. Disconnect client, change to something different, reconnect client without restarting, SyncVar hook fires ✅
  3. Disconnect client, change back to default value, reconnect client without restarting, SyncVar hook fires with "default" value ❓

Expected behavior It might be more intuitive to reset scene objects to their default state when disconnecting

Screenshots left side: host, inspector: networked scene object, right side: client https://share.dl.je/2021/03/2021-03-24_00-45-33_qXvCbPvObp.mp4

imerr avatar Mar 24 '21 11:03 imerr

Expected behavior It might be more intuitive to reset scene objects to their default state when disconnecting

I don't think we should be silently doing this. If you want the scene restored, reload it, or have offline and online scenes set up and assigned so you get a new Network Manager in the offline scene to ensure a clean restart.

MrGadget1024 avatar May 28 '21 05:05 MrGadget1024