Photon Quantum 3.0.0

Public Member Functions | Properties | List of all members
Quantum.IQuantumEntityViewPool Interface Reference

Interface to create custom implementation of the entity view pool that can be assigned to the QuantumEntityViewUpdater.Pool. More...

Inheritance diagram for Quantum.IQuantumEntityViewPool:
Quantum.QuantumEntityViewPool

Public Member Functions

GameObject Create (GameObject prefab, bool activate=true, bool createIfEmpty=true)
 Create a pooled game object. More...
 
GameObject Create (GameObject prefab, Transform parent, bool activate=true, bool createIfEmpty=true)
 Create a pooled game object. More...
 
Create< T > (T prefab, bool activate=true, bool createIfEmpty=true)
 Create a pooled game object and return the component of chose type. More...
 
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...
 
void Destroy (Component component, bool deactivate=true)
 Destroy or return the pooled game object that the component is attached to. More...
 
void Destroy (GameObject instance, bool deactivate=true)
 Destroy or return the pooled game object. More...
 
void Destroy (GameObject instance, float delay)
 Destroy or return the pooled game object after a delay. More...
 
void Prepare (GameObject prefab, int desiredCount)
 Create prefab instances and fill the pool. More...
 

Properties

int BorrowedCount [get]
 Returns how many pooled items are currently in use. More...
 
int PooledCount [get]
 Returns how many items are inside the pool in total. More...
 

Detailed Description

Interface to create custom implementation of the entity view pool that can be assigned to the QuantumEntityViewUpdater.Pool.

Member Function Documentation

◆ Create< T >() [1/2]

T Quantum.IQuantumEntityViewPool.Create< T > ( prefab,
bool  activate = true,
bool  createIfEmpty = true 
)

Create a pooled game object and return the component of chose type.

Template Parameters
TComponent type
Parameters
prefabPrefab to instantiate
activateCall SetActive() on the game object
createIfEmptyCreate a new entity if there is no suitable one found in the pool
Returns
Component on the created prefab instance, can be null

Implemented in Quantum.QuantumEntityViewPool.

Type Constraints
T :Component 

◆ Create() [1/2]

GameObject Quantum.IQuantumEntityViewPool.Create ( GameObject  prefab,
bool  activate = true,
bool  createIfEmpty = true 
)

Create a pooled game object.

Parameters
prefabPrefab to instantiate
activateCall SetActive() on the game object
createIfEmptyCreate a new entity if there is no suitable one found in the pool
Returns
An instance of the prefab

Implemented in Quantum.QuantumEntityViewPool.

◆ Create< T >() [2/2]

T Quantum.IQuantumEntityViewPool.Create< T > ( prefab,
Transform  parent,
bool  activate = true,
bool  createIfEmpty = true 
)

Create a pooled game object and return the component of chose type.

Template Parameters
TComponent type
Parameters
prefabPrefab to instantiate
parentCalls SetParent(parent) on the new game object transform when set
activateCall SetActive() on the game object
createIfEmptyCreate a new entity if there is no suitable one found in the pool
Returns
Component on the created prefab instance, can be null

Implemented in Quantum.QuantumEntityViewPool.

Type Constraints
T :Component 

◆ Create() [2/2]

GameObject Quantum.IQuantumEntityViewPool.Create ( GameObject  prefab,
Transform  parent,
bool  activate = true,
bool  createIfEmpty = true 
)

Create a pooled game object.

Parameters
prefabPrefab to instantiate
parentCalls SetParent(parent) on the new game object transform when set
activateCall SetActive() on the game object
createIfEmptyCreate a new entity if there is no suitable one found in the pool
Returns
An instance of the prefab

Implemented in Quantum.QuantumEntityViewPool.

◆ Destroy() [1/3]

void Quantum.IQuantumEntityViewPool.Destroy ( Component  component,
bool  deactivate = true 
)

Destroy or return the pooled game object that the component is attached to.

Parameters
componentComponent that belongs to the pooled game object.
deactivateCall SetActive(false) on the pooled game object before returning it to the pool

Implemented in Quantum.QuantumEntityViewPool.

◆ Destroy() [2/3]

void Quantum.IQuantumEntityViewPool.Destroy ( GameObject  instance,
bool  deactivate = true 
)

Destroy or return the pooled game object.

Parameters
instancePoole game object
deactivateCall SetActive(false) on the pooled game object before returning it to the pool

Implemented in Quantum.QuantumEntityViewPool.

◆ Destroy() [3/3]

void Quantum.IQuantumEntityViewPool.Destroy ( GameObject  instance,
float  delay 
)

Destroy or return the pooled game object after a delay.

Parameters
instancePoole game object
delayDelay in seconds to complete returning it to the pool

Implemented in Quantum.QuantumEntityViewPool.

◆ Prepare()

void Quantum.IQuantumEntityViewPool.Prepare ( GameObject  prefab,
int  desiredCount 
)

Create prefab instances and fill the pool.

Parameters
prefabPrefab to created pooled instances
desiredCountThe number of instances to create and add to the pool

Implemented in Quantum.QuantumEntityViewPool.

Property Documentation

◆ PooledCount

int Quantum.IQuantumEntityViewPool.PooledCount
get

Returns how many items are inside the pool in total.

◆ BorrowedCount

int Quantum.IQuantumEntityViewPool.BorrowedCount
get

Returns how many pooled items are currently in use.