Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Network Manager returns false for all of IsServer/IsHost/IsClient after changing scene

Discussion in 'Netcode for GameObjects' started by EnderDremurr, Nov 11, 2023.

  1. EnderDremurr

    EnderDremurr

    Joined:
    Jun 12, 2020
    Posts:
    1
    I have two scenes: Lobby and main Game scene
    In lobby i gather all people and right there start their network managers (host and clients) and after that change scene with Network Scene Manager to the Game scene.
    The issue is that after loading Game scene, if i check is player a host/client/server it always return false, even though in inspector it shows that network manager is running
    upload_2023-11-11_19-5-54.png

    upload_2023-11-11_19-6-12.png
    upload_2023-11-11_19-6-24.png

    There, if i press "Stop host" in inspector and then "Start host" it starts working as it should
    upload_2023-11-11_19-7-26.png

    Where could be an issue? i don't quite understand where it comes from, or do i need to call something after scene has changed to ensure that network manager is properly working?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,961
    WHERE do you make this check?

    Be sure to wait until OnNetworkSpawn ran for the given object.