fix: NetworkServer.Spawn now activates inactive GameObjects (for example, in case they were previously Unspawned)

This commit is contained in:
mischa 2024-03-05 11:56:47 +01:00 committed by MrGadget
parent 1e40999503
commit 7715ac700b

View File

@ -1506,6 +1506,10 @@ static void SpawnObject(GameObject obj, NetworkConnection ownerConnection)
if (ownerConnection is LocalConnectionToClient)
identity.isOwned = true;
// NetworkServer.Unspawn sets object as inactive.
// NetworkServer.Spawn needs to set them active again in case they were previously unspawned / inactive.
identity.gameObject.SetActive(true);
// only call OnStartServer if not spawned yet.
// check used to be in NetworkIdentity. may not be necessary anymore.
if (!identity.isServer && identity.netId == 0)