An implementation of a EntityView pool to be used with the QuantumEntityViewUpdater.Pool. Add this behaviour to the same game object that the QuantumEntityViewUpdater behaviour is on. Using QuantumCallback.Subscribe() with pooled objects as listener needs to use the onlyIfActiveAndEnabled option to not be callbacks from disabled pooled objects.
More...
|
void | Awake () |
| Create pre cached pooled game objects during Awake(). More...
|
|
virtual GameObject | Create (GameObject prefab, bool activate=true, bool createIfEmpty=true) |
| Create a pooled game object. More...
|
|
virtual GameObject | Create (GameObject prefab, Transform parent, bool activate=true, bool createIfEmpty=true) |
| Create a pooled game object. More...
|
|
virtual T | Create< T > (T prefab, bool activate=true, bool createIfEmpty=true) |
| Create a pooled game object and return the component of chose type. More...
|
|
virtual T | Create< T > (T prefab, Transform parent, bool activate=true, bool createIfEmpty=true) |
| Create a pooled game object and return the component of chose type. More...
|
|
virtual void | Destroy (Component component, bool deactivate=true) |
| Destroy or return the pooled game object that the component is attached to. More...
|
|
virtual void | Destroy (GameObject instance, bool deactivate=true) |
| Destroy or return the pooled game object. More...
|
|
virtual void | Destroy (GameObject instance, float delay) |
| Destroy or return the pooled game object after a delay. More...
|
|
void | OnDestroy () |
| Shutdown the pool. More...
|
|
virtual void | Prepare (GameObject prefab, int desiredCount) |
| Create prefab instances and fill the pool. More...
|
|
void | Update () |
| Update is used to track deferred pooled game object destroy requests. More...
|
|
An implementation of a EntityView pool to be used with the QuantumEntityViewUpdater.Pool. Add this behaviour to the same game object that the QuantumEntityViewUpdater behaviour is on. Using QuantumCallback.Subscribe() with pooled objects as listener needs to use the onlyIfActiveAndEnabled option to not be callbacks from disabled pooled objects.
◆ Create< T >() [1/2]
Create a pooled game object and return the component of chose type.
- Template Parameters
-
- Parameters
-
prefab | Prefab to instantiate |
activate | Call SetActive() on the game object |
createIfEmpty | Create a new entity if there is no suitable one found in the pool |
- Returns
- Component on the created prefab instance, can be null
Implements Quantum.IQuantumEntityViewPool.
◆ Create() [1/2]
virtual GameObject Quantum.QuantumEntityViewPool.Create |
( |
GameObject |
prefab, |
|
|
bool |
activate = true , |
|
|
bool |
createIfEmpty = true |
|
) |
| |
|
inlinevirtual |
Create a pooled game object.
- Parameters
-
prefab | Prefab to instantiate |
activate | Call SetActive() on the game object |
createIfEmpty | Create a new entity if there is no suitable one found in the pool |
- Returns
- An instance of the prefab
Implements Quantum.IQuantumEntityViewPool.
◆ Create< T >() [2/2]
Create a pooled game object and return the component of chose type.
- Template Parameters
-
- Parameters
-
prefab | Prefab to instantiate |
parent | Calls SetParent(parent) on the new game object transform when set |
activate | Call SetActive() on the game object |
createIfEmpty | Create a new entity if there is no suitable one found in the pool |
- Returns
- Component on the created prefab instance, can be null
Implements Quantum.IQuantumEntityViewPool.
◆ Create() [2/2]
virtual GameObject Quantum.QuantumEntityViewPool.Create |
( |
GameObject |
prefab, |
|
|
Transform |
parent, |
|
|
bool |
activate = true , |
|
|
bool |
createIfEmpty = true |
|
) |
| |
|
inlinevirtual |
Create a pooled game object.
- Parameters
-
prefab | Prefab to instantiate |
parent | Calls SetParent(parent) on the new game object transform when set |
activate | Call SetActive() on the game object |
createIfEmpty | Create a new entity if there is no suitable one found in the pool |
- Returns
- An instance of the prefab
Implements Quantum.IQuantumEntityViewPool.
◆ Destroy() [1/3]
virtual void Quantum.QuantumEntityViewPool.Destroy |
( |
Component |
component, |
|
|
bool |
deactivate = true |
|
) |
| |
|
inlinevirtual |
Destroy or return the pooled game object that the component is attached to.
- Parameters
-
component | Component that belongs to the pooled game object. |
deactivate | Call SetActive(false) on the pooled game object before returning it to the pool |
Implements Quantum.IQuantumEntityViewPool.
◆ Destroy() [2/3]
virtual void Quantum.QuantumEntityViewPool.Destroy |
( |
GameObject |
instance, |
|
|
bool |
deactivate = true |
|
) |
| |
|
inlinevirtual |
Destroy or return the pooled game object.
- Parameters
-
instance | Poole game object |
deactivate | Call SetActive(false) on the pooled game object before returning it to the pool |
Implements Quantum.IQuantumEntityViewPool.
◆ Destroy() [3/3]
virtual void Quantum.QuantumEntityViewPool.Destroy |
( |
GameObject |
instance, |
|
|
float |
delay |
|
) |
| |
|
inlinevirtual |
Destroy or return the pooled game object after a delay.
- Parameters
-
instance | Poole game object |
delay | Delay in seconds to complete returning it to the pool |
Implements Quantum.IQuantumEntityViewPool.
◆ Prepare()
virtual void Quantum.QuantumEntityViewPool.Prepare |
( |
GameObject |
prefab, |
|
|
int |
desiredCount |
|
) |
| |
|
inlinevirtual |
Create prefab instances and fill the pool.
- Parameters
-
prefab | Prefab to created pooled instances |
desiredCount | The number of instances to create and add to the pool |
Implements Quantum.IQuantumEntityViewPool.
◆ Awake()
void Quantum.QuantumEntityViewPool.Awake |
( |
| ) |
|
|
inline |
Create pre cached pooled game objects during Awake().
◆ OnDestroy()
void Quantum.QuantumEntityViewPool.OnDestroy |
( |
| ) |
|
|
inline |
◆ Update()
void Quantum.QuantumEntityViewPool.Update |
( |
| ) |
|
|
inline |
Update is used to track deferred pooled game object destroy requests.
◆ PooledCount
int Quantum.QuantumEntityViewPool.PooledCount |
|
get |
Returns how many items are inside the pool in total.
◆ BorrowedCount
int Quantum.QuantumEntityViewPool.BorrowedCount |
|
get |
Returns how many pooled items are currently in use.