Skip to content

Commit 65a9d0f

Browse files
committed
Return cached objects
1 parent 41dbab5 commit 65a9d0f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Assets/FishNet/Runtime/Utility/Performance/DefaultObjectPool.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,13 @@ public override void StoreObject(NetworkObject instantiated, bool asServer)
165165
}
166166

167167
/// <summary>
168-
/// Instantiates a number of objects and adds them to the pool.
168+
/// Instantiates a number of objects, adds them to the pool, and returns the objects.
169169
/// </summary>
170170
/// <param name="prefab">Prefab to cache.</param>
171171
/// <param name="count">Quantity to spawn.</param>
172172
/// <param name="asServer">True if storing prefabs for the server collection. This is only applicable when using DualPrefabObjects.</param>
173-
public override void CacheObjects(NetworkObject prefab, int count, bool asServer)
173+
/// <returns></returns>
174+
public override Stack<NetworkObject> CacheObjects(NetworkObject prefab, int count, bool asServer)
174175
{
175176
if (!_enabled)
176177
return;
@@ -191,6 +192,8 @@ public override void CacheObjects(NetworkObject prefab, int count, bool asServer
191192
nob.gameObject.SetActive(false);
192193
cache.Push(nob);
193194
}
195+
196+
return cache;
194197
}
195198

196199
/// <summary>

0 commit comments

Comments
 (0)