The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Fusion - Late joining players and existing NetworkObjects

2022-08-20 13:37:58

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.


2022-08-20 18:52:06

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 :)

Back to top