-
Notifications
You must be signed in to change notification settings - Fork 0
API
This API reference documents all areas of the public API for Replicator.
Please note: while it is possible to configure a Unity project in a way which allows client code to use them, use of members marked internal is neither intended nor supported for client code.
Contents
Namespace containing all of the public Replicator API.
Asset representing and providing a pool of GameObjects.
GameObject Spawn(Vector3 position, Quaternion rotation, Transform parent = null)
Spawn a GameObject from the pool, if one is available.
Parameters
-
position: Position of the spawned GameObject -
rotation: Rotation of the spawned GameObject -
parent: (optional) Parent of the spawned GameObject
void Recycle(GameObject gameObject)
Recycle the gameObject if it belongs to this pool.
Parameters
-
gameObject: The GameObject to recycle
Interfaces are provided for client code to trigger actions during the Spawn / Recycle lifecycle.
Interface for hooking into a GameObject's spawn phase.
void OnSpawn()
Callback called after the associated GameObject is spawned, but before it is returned.
Interface for hooking into a GameObject's recycle phase.
void OnRecycle()
Callback to implement cleanup or other actions when the GameObject this script is attached to is recycled.
Provides callbacks for Spawning & Recycling GameObjects.
Extensions to UnityEngine.MonoBehaviour to facilitate mimicking Unity's Instantiate and Destroy API.
Overloads:
GameObject Spawn(GameObject original, Transform parent = null)GameObject Spawn(GameObject original, Vector3 position, Quaternion rotation, Transform parent = null)
Spawn a copy of original if it is a pooled GameObject.
Parameters:
-
original: The GameObject to spawn a copy of -
position: Position of the spawned GameObject -
rotation: Rotation of the spawned GameObject -
parent: (optional) Parent of the spawned GameObject
Overloads:
void Recycle(GameObject target)void Recycle(GameObject target, float delay)
Recycle the target GameObject, if it was spawned from a pool.
Parameters:
-
target: The GameObject to recycle -
delay: An optional delay, in seconds, before recycling the GameObject
Extensions to UnityEngine.GameObject for Spawning & Recycling them.
Overloads:
GameObject Spawn(Transform parent = null)GameObject Spawn(Vector3 position, Quaternion rotation, Transform parent = null)
Spawn a copy of the GameObject, if it is a pooled GameObject.
Parameters:
-
position: Position of the spawned GameObject -
rotation: Rotation of the spawned GameObject -
parent: (optional) Parent of the spawned GameObject
void Recycle()
Recycle this GameObject, if it belongs to a pool.