-
Notifications
You must be signed in to change notification settings - Fork 463
Description
Hey, I'm in a situation where rather than just using Main Menu UI driven approach for setting up games I have a 'hub world' where my player prefab/gameobject is already instantiated (it has NetworkObject on it, but its in an offline/dormant state at this time, not spawned in NGO, NGO not even connected) and it walks around the hub to different spots to trigger stuff, including a Multiplayer mode place, where he can join a lobby (using Steam lobbies currently) and upon creating/joining a steam lobby I also join as a Host/Client in NGO / Network Manager (Distributed Authority, Scene Management disabled).
This works ok for the initial Host/Lobby creator, but then on a 2nd Client as soon as he joins the session the NetworkSpawnManager.DestroySceneObjects() is called destroying my 'offline' Player gameObject from the hub scene, which i definitely dont want to happen at this stage, as the lobby is only begining to form and its not even decided there will be an actual game session starting. I can't find any way of preventing this from happening, outside from just not connecting NGO Clients at this stage and only relying on the Steam lobby solution for the entirety of pre-game communication, but I would much prefer to be able to already use NGO at this point and be mostly independent of platform specific lobby solutions.
I've been told on Unity discord that my 'offline' GameObject should not have a NetworkObject on it in the first place, but that in itself presents a certain issue when using Prefab Variants, and i do use them extensively for my gameplay objects, where I have a variant hierarchy where 100+ hero/enemy/boss prefabs use the same root prefab. So rather than duplicating each 'top tier' prefab variant to create and use as a network variant (which would double their count and would have to be maintained forever whenever i add/delete enemies etc), I opted for adding NetworkObject/NetworkBehaviours on the root prefab so its just always there, dormant during offline play and utilized during online sessions. This does seem to work overall, the NetworkObject presence doesnt interfere during offline gameplay and then works as intended for online sessions, except for this one issue im having here.