Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Update from 1.6.0 to 1.7.0 not spawning Network Prefabs (Scene Manage Off, Observers Off)

Discussion in 'Netcode for GameObjects' started by Devseba, Oct 26, 2023.

  1. Devseba

    Devseba

    Joined:
    Feb 26, 2021
    Posts:
    9
    Hi,

    Just updating NGO from 1.6.0 to 1.7.0 is causing my Network Prefabs not spawning anymore.

    Configuration
    - Enable Scene Management: Off.
    - Player Prefab with "Spawn with Observers" turned on.
    - Network Prefab List: single list with 1 item only ("Multiplayer Manager").
    - "Multiplayer Manager": network object with all options disabled, including "Spawn with Observers".

    Working with NGO 1.6.0
    Not Working with NGO 1.7.0

    Issue: "Multiplayer Manager" is not spawning anymore.
    It was spawning after client calls "NetworkManager.Singleton.StartClient();"

    Conclusion
    It seems that with "Enable Scene Management" turned off, prefabs will not spawn unless "Spawn with Observers" is turned On. This applies also to "Player Prefab" of the Network Manager.

    Expected Behaviour
    I think the prefabs should spawn regardless of the Observer option.

    Question
    Is this the intended behaviour? I'm just learning, but it will help to know what path to follow.
    If this is intended, I will need to manually disable all non wanted observers.

    I'm building a game with multiples rooms (1v1, 2v2, 3v3).

    With NGO 1.6.0, the idea was to start with 0 observers and add them manually when the players meet inside the room.
    With NGO 1.7.0, it seems I need to do the opposite. And I think is a bit dirty because they will start with the information of all other players.

    Thank you,
    Regards
     
    Last edited: Oct 26, 2023
    Rouxer likes this.
  2. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    687
    I think this is expected behaviour, although I've not tried the code since Spawn with Observers was added, I did a try a little test.

    My understanding is, with Spawn with Observers on client spawning is governed by NetworkObject.CheckObjectVisibility. If Spawn with Observers is off the object isn't spawned on clients and you control the spawning with NetworkObject.NetworkShow/Hide. Spawn with Observers was added to put back in functionality that was lost when a fix went in for a longstanding issue with CheckObjectVisibility.

    Actually I've just noticed if CheckObjectVisibility returns true but Spawn with Observers is off the client is on the object's observer list, that doesn't seem right.
     
    Devseba likes this.
  3. Devseba

    Devseba

    Joined:
    Feb 26, 2021
    Posts:
    9