#NetworkObjects not syncing to clients with custom scene management

5 messages · Page 1 of 1 (latest)

uneven mulch
#

I'm fairly new to FishNet and have been struggling to convert my project over from Unity Multiplayer. Please help!

Background:

  • Migrating from Unity Multiplayer to FishNet + FishyEOS
  • Using custom pooling system and scene management
  • Need to share code between networked and local gameplay

Environment:

  • Unity: 6000.2.0b3 (Unity 6 Beta)
  • Windows 11
  • FishNet: 4.6.8
  • FishyEOS: [Using FishNet.Transporting.FishyEOSPlugin]

Objective:
Spawn NetworkObjects dynamically in specific scenes with ability to reparent them, while ensuring proper client synchronization.

Current Approach:

var flag = Object.Instantiate(_prefab, transform, true);
// If network game and we're host, spawn on network 
if (_networkManager && _networkManager.IsHost)
{
    _networkManager.Spawn(flag.gameObject);
    Log($"PlaceOneFlag - Network spawned flag {i}");
}

Issue:

  • When NetworkObject._isGlobal = true: Objects spawn correctly on clients but automatically get moved to DontDestroyOnLoad, preventing scene-specific placement and reparenting
  • When NetworkObject._isGlobal = false: Objects don't propagate to clients at all, and renderer gets disabled on host

Desired Behavior:

  • Objects should spawn in the current scene (not moved to DontDestroyOnLoad)
  • Objects should be visible and synchronized across all clients
  • Objects should remain reparentable after network spawn

Key Questions:

  1. Is there a way to spawn scene-based NetworkObjects (_isGlobal = false) that properly synchronize to clients when using custom scene management?
  2. What's the recommended pattern for dynamic spawning with Object.Instantiate() + NetworkManager.Spawn() when not using FishNet's default scene loading?

Additional Context:

  • Have custom scene management system, not using FishNet's built-in scene loading
  • I'm using Addressables for all scenes apart from bootstrap
  • Objects need to be spawned dynamically during gameplay, not pre-placed in scenes
quaint sinew
#

Hi there, so the objects being disabled/invisible is simply due to the clients not observing them. Since you aren't loading the scenes through the FishNet SceneManager you'll need to manually tell FishNet that the client is ready to observe them.
You can do this with the SceneManager.AddConnectionToScene method: https://firstgeargames.com/FishNet/api/api/FishNet.Managing.Scened.SceneManager.html#FishNet_Managing_Scened_SceneManager_AddConnectionToScene_FishNet_Connection_NetworkConnection_UnityEngine_SceneManagement_Scene_

As far as IsGlobal, that's only for objects you want to exist in the DDoL scene and be observed by all clients. So not what you need here.

If using addressables this page might be helpful too: https://fish-networking.gitbook.io/docs/guides/features/addressables

#

Especially the part on addressable objects

#

As the scene loading you are already handling manually

uneven mulch
#

@quaint sinew Thank you so much for replying and your clear, concise guidance.
I applied the method described and managed to spawn the flag prefabs from my earlier example. Now, to conver the others too!

Thank you again - I struggled for days to try to work this out and am delighted and very grateful to have your solution.