MirrorNetworking / MirrorNetworking/Mirror

Scene objects are not reset after disconnecting

Open
#2,670 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.3k
Forks
870
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a networked scene object containing a SyncVar, following the disconnect/reconnect sequence described in the report. Trace the scene-object lifecycle during client disconnect and reconnect, and verify that objects return to their default state and SyncVar hooks behave consistently on subsequent connections.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-dev, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.