Fusion - Late joining players and existing NetworkObjects

Options

Hi everyone, so I'm having a bit of difficulty navigating a specific problem I'm having with Fusion currently.

What I'm attempting to do is create PlayerData for each player that joins the game, put this inside a NetworkObject / NetworkBehaviour, and spawn them from the Host as the players join.

Currently when the host first loads in, it spawns a PlayerData for player 9, then when the first player joins, it creates a PlayerData for player 0 (the joined player). The joined player can see the PlayerData for player 0, but not the host PlayerData (for player 9).

I made the assumption that any pre-existing NetworkObjects in-game would automatically be replicated on a joining player's client. Is this true? Or was I mistaken? If it's not, does Fusion provide the mechanism to do this, or is this something I need to do manually?

The lines that I'm running to spawn the PlayerData is this:

if (Runner.IsServer)

Runner.Spawn(_playerDataPrefab, null, null, player);

_playerDataPrefab being the prefab of the PlayerData, and the player being a PlayerRef on the player that just joined.

Any help would be appreciated.

Comments

  • Grinneh
    Options

    So I ended up finding the issue.

    My object was despawning prematurely, had to write up logs in order to track down what was actually happening. The object would despawn on scene load, so I just made sure that it didn't, and everything is working as expected :)