mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
OnStartServer spawned assignment moved to NetworkServer caller
This commit is contained in:
parent
c6df8f01d8
commit
75e7af1312
@ -639,10 +639,6 @@ internal void OnStartServer()
|
||||
|
||||
//Debug.Log($"OnStartServer {this} NetId:{netId} SceneId:{sceneId:X}");
|
||||
|
||||
// add to spawned (note: the original EnableIsServer isn't needed
|
||||
// because we already set m_isServer=true above)
|
||||
NetworkServer.spawned[netId] = this;
|
||||
|
||||
// in host mode we set isClient true before calling OnStartServer,
|
||||
// otherwise isClient is false in OnStartServer.
|
||||
if (NetworkClient.active)
|
||||
|
@ -1191,6 +1191,9 @@ static void SpawnObject(GameObject obj, NetworkConnection ownerConnection)
|
||||
identity.isLocalPlayer = NetworkClient.localPlayer == identity;
|
||||
identity.netId = NetworkIdentity.GetNextNetworkId();
|
||||
|
||||
// add to spawned (after assigning netId)
|
||||
spawned[identity.netId] = identity;
|
||||
|
||||
// callback after all fields were set
|
||||
identity.OnStartServer();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user