Search Unity

Question Problem with the relay and lobby game services

Discussion in 'Lobby' started by elzbeb, Jan 8, 2023.

  1. elzbeb

    elzbeb

    Joined:
    Jul 30, 2020
    Posts:
    54
    Hey so I made a quick join functionality where the player joins an available lobby if there is one automatically and if there isnt one then they create the lobby. The issue is that I am getting this warning message when a client (any player other than the host) disconnects/leaves the game

    [Netcode] NetworkBehaviour-PlayerArmature(Clone) is being destroyed while NetworkObject-PlayerArmature(Clone) is still spawned! (could break state synchronization)


    When I run back the game instead of putting me in the host's lobby its creating a new lobby and what I understand from what the warning message is saying is that the player is destroyed but is still spawned so it cant reconnect me because it thinks that I am already in the game.

    I tried the OnNetworkDespawn and this is what I am doing but idk if I am missing something


    Code (CSharp):
    1. public override void OnNetworkDespawn()
    2. {
    3.     base.OnNetworkDespawn();
    4. }

    For any further needed info please let me know and I will respond asap.