From e3c894389d49bdb90006b43265764b344ff4669b Mon Sep 17 00:00:00 2001 From: vis2k Date: Mon, 17 Dec 2018 13:35:21 +0100 Subject: [PATCH] Removed unnecessarily complex ClientScene.GetSpawnHandler function --- Mirror/Runtime/ClientScene.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Mirror/Runtime/ClientScene.cs b/Mirror/Runtime/ClientScene.cs index ee02bb451..b2edabef7 100644 --- a/Mirror/Runtime/ClientScene.cs +++ b/Mirror/Runtime/ClientScene.cs @@ -349,17 +349,6 @@ public static void ClearSpawners() unspawnHandlers.Clear(); } - internal static bool GetSpawnHandler(Guid assetId, out SpawnDelegate handler) - { - if (spawnHandlers.ContainsKey(assetId)) - { - handler = spawnHandlers[assetId]; - return true; - } - handler = null; - return false; - } - internal static bool InvokeUnSpawnHandler(Guid assetId, GameObject obj) { if (unspawnHandlers.ContainsKey(assetId) && unspawnHandlers[assetId] != null) @@ -471,7 +460,7 @@ static void OnSpawnPrefab(NetworkMessage netMsg) ApplySpawnPayload(localObject, msg.position, msg.payload, msg.netId); } // lookup registered factory for type: - else if (GetSpawnHandler(msg.assetId, out handler)) + else if (spawnHandlers.TryGetValue(msg.assetId, out handler)) { GameObject obj = handler(msg.position, msg.assetId); if (obj == null)