Best Practices for Initializing State and Determining Local vs. Remote Spawned Objects?

Options

Hi,

I'm finding the Fusion documentation a bit ambiguous and wanted to clarify a few things.

  1. OnBeforeSpawn always runs on the server. Is it safe to assume that any Networked properties that I initialize here will be set when Spawned() is called on the remote side? I assume that Photon ships over the initial state snapshot when sending a spawn request to clients.
  2. What is the best practice for identifying whether an instance of a spawned object is "local" (that is, represents something on the given client) or not? For example, I am spawning avatars. Local avatars are driven by the local user's machine so I need to know which objects these are. Currently, I'm setting a Networked property for the player ID in OnBeforeSpawn(). Then, in Spawned(), I set: _isLocal = _netObj.Runner.LocalPlayer.PlayerId == _playerID. Where _netObj is the NetworkObject.
  3. Is there any callback we can listen to to detect that an object has been spawned on a client (in order to e.g., initialize it)? Again, in my case, my prefab has some fields that need to be populated at run-time. Rather than having the scripts on the prefab itself search for these, it seems cleaner to have some callback that informs me the object has been spawned.

Thanks,

--B.