Search Unity

Question Mirrors ClientRpc never gets called after SceneChange

Discussion in 'Multiplayer' started by AlexCine, Feb 22, 2024.

  1. AlexCine

    AlexCine

    Joined:
    Feb 16, 2022
    Posts:
    1
    Hello there,

    Setup: I instantiate the Playerobject in a Lobbyscene, while staying in the Lobbyscene everything works fine, Commands and RPC´s. The problem is, after I change to a Gamescene, I cannot call any ClientRPCs from any Gameobject from the Gamescene to the Playerobject, that was instantiated from another scene but stays in the new Scene because of DontdestroyonLoad. However I can still call a ClientRPC from the Playerobject to the Playerobject or the Gamemanager that was also instantiated on the Lobbyscene. I never get any Errors or whatsoever that could give me a Hint to what I am suppost to do.

    I have come to understand that every NetworkIdentity from Mirror has a SceneID. And every NetworkIdentity gets their Id from the Scene they comefrom.

    When I create an Object in the Lobby, they have a SceneID of 0, and it dosent change even after the Scene changes. When I change the scene now however, every other Object that dosent come from the Lobbyscene has a constant ID of 16949... and so forth. Changing the SceneID at runtime after switching the scene dosent do anything

    The question is the SceneID the problem and how can I fix everything or am I missing something obvious?
     

    Attached Files: