Skip to content

Commit d910235

Browse files
refactor: network object pool part 2 (#827)
* removing an unneeded method
1 parent fc27774 commit d910235

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

Assets/Scripts/Infrastructure/NetworkObjectPool.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ public void OnValidate()
8686
/// <returns></returns>
8787
public NetworkObject GetNetworkObject(GameObject prefab, Vector3 position, Quaternion rotation)
8888
{
89-
return GetNetworkObjectInternal(prefab, position, rotation);
89+
var networkObject = m_PooledObjects[prefab].Get();
90+
91+
var noTransform = networkObject.transform;
92+
noTransform.position = position;
93+
noTransform.rotation = rotation;
94+
95+
return networkObject;
9096
}
9197

9298
/// <summary>
@@ -141,24 +147,6 @@ void ActionOnDestroy(NetworkObject networkObject)
141147
// Register Netcode Spawn handlers
142148
NetworkManager.Singleton.PrefabHandler.AddHandler(prefab, new PooledPrefabInstanceHandler(prefab, this));
143149
}
144-
145-
/// <summary>
146-
/// This matches the signature of <see cref="NetworkSpawnManager.SpawnHandlerDelegate"/>
147-
/// </summary>
148-
/// <param name="prefab"></param>
149-
/// <param name="position"></param>
150-
/// <param name="rotation"></param>
151-
/// <returns></returns>
152-
NetworkObject GetNetworkObjectInternal(GameObject prefab, Vector3 position, Quaternion rotation)
153-
{
154-
var networkObject = m_PooledObjects[prefab].Get();
155-
156-
var noTransform = networkObject.transform;
157-
noTransform.position = position;
158-
noTransform.rotation = rotation;
159-
160-
return networkObject;
161-
}
162150
}
163151

164152
[Serializable]

0 commit comments

Comments
 (0)