From 7715ac700bb00c3937b227e00f7d263c8f4e6cdd Mon Sep 17 00:00:00 2001 From: mischa <16416509+vis2k@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:56:47 +0100 Subject: [PATCH] fix: NetworkServer.Spawn now activates inactive GameObjects (for example, in case they were previously Unspawned) --- Assets/Mirror/Core/NetworkServer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assets/Mirror/Core/NetworkServer.cs b/Assets/Mirror/Core/NetworkServer.cs index 212bc2805..ab180f0f0 100644 --- a/Assets/Mirror/Core/NetworkServer.cs +++ b/Assets/Mirror/Core/NetworkServer.cs @@ -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)