Class SwiftGameObjectPoolManager
- Namespace
- SwiftCollections.Pool
A singleton-based manager for accessing and managing pooled GameObjects through a SwiftGameObjectPoolAsset.
public class SwiftGameObjectPoolManager
- Inheritance
-
SwiftGameObjectPoolManager
- Inherited Members
Properties
Shared
Gets the shared singleton instance of the object pooler.
public static SwiftGameObjectPoolManager Shared { get; }
Property Value
Methods
GetObject(string)
Gets a pooled GameObject by ID.
public GameObject GetObject(string id)
Parameters
idstringThe pool name.
Returns
- GameObject
A pooled GameObject instance.
GetParentTransform()
Gets the parent transform managing all pooled objects.
public Transform GetParentTransform()
Returns
- Transform
The parent transform.
ReleaseObject(string, GameObject)
Releases a pooled GameObject back into the specified pool.
public void ReleaseObject(string id, GameObject gameObject)
Parameters
idstringThe pool name.
gameObjectGameObjectThe pooled instance to release.
TryGetObject(string, out GameObject)
Attempts to get a pooled GameObject by ID without throwing when the pool is missing or exhausted.
public bool TryGetObject(string id, out GameObject gameObject)
Parameters
idstringThe pool name.
gameObjectGameObjectThe pooled GameObject instance when successful.
Returns
- bool
truewhen an object was acquired; otherwisefalse.