Describe the bug
so, after spending a bunch of time debugging
When you host,
when an object spawns in it generates a spawn payload message, however this is immediately when the object is created so only SyncVars that are set in the wake are initialised properly, whilst things that would be post-spawn
e.g
var object = spawn
object.setup(data)
would be not caught in the initial state,
due to the host mode, processing SpawnMessage, and the associated SyncVars, that means any values that were set post spawn message Serialisation would be set to default value (Since it does all SyncVars),
and then since host mode ignores EntityStateMessage,
that would have the serialised data of what you set it to after spawning it, resulting in the host getting set to an incorrect state
this combines with another issue
Where if you set a SyncVar in host mode, before receiving the spawn message, so in the same frame your spawning it it won't directly trigger hook function
if (NetworkServer.activeHost && !GetSyncVarHookGuard(dirtyBit) && NetworkClient.spawned.ContainsKey(netIdentity.netId))
since it's not yet in NetworkClient.spawned
tested on Commit 0eab9bd (latest to commit as of writing)
Describe the bug
so, after spending a bunch of time debugging
When you host,
when an object spawns in it generates a spawn payload message, however this is immediately when the object is created so only SyncVars that are set in the wake are initialised properly, whilst things that would be post-spawn
e.g
would be not caught in the initial state,
due to the host mode, processing SpawnMessage, and the associated SyncVars, that means any values that were set post spawn message Serialisation would be set to default value (Since it does all SyncVars),
and then since host mode ignores EntityStateMessage,
that would have the serialised data of what you set it to after spawning it, resulting in the host getting set to an incorrect state
this combines with another issue
Where if you set a SyncVar in host mode, before receiving the spawn message, so in the same frame your spawning it it won't directly trigger hook function
since it's not yet in NetworkClient.spawned
tested on Commit 0eab9bd (latest to commit as of writing)