Photon.Pun.DefaultPool Class Reference

The default implementation of a PrefabPool for PUN, which actually Instantiates and Destroys GameObjects but pools a resource. More...

Inheritance diagram for Photon.Pun.DefaultPool:
Photon.Pun.IPunPrefabPool

Public Member Functions

GameObject Instantiate (string prefabId, Vector3 position, Quaternion rotation)
 Returns an inactive instance of a networked GameObject, to be used by PUN. More...
 
void Destroy (GameObject gameObject)
 Simply destroys a GameObject. More...
 

Public Attributes

readonly Dictionary< string, GameObject > ResourceCache = new Dictionary<string, GameObject>()
 Contains a GameObject per prefabId, to speed up instantiation. More...
 

Detailed Description

The default implementation of a PrefabPool for PUN, which actually Instantiates and Destroys GameObjects but pools a resource.

This pool is not actually storing GameObjects for later reuse. Instead, it's destroying used GameObjects. However, prefabs will be loaded from a Resources folder and cached, which speeds up Instantiation a bit.

The ResourceCache is public, so it can be filled without relying on the Resources folders.

Member Function Documentation

◆ Destroy()

void Photon.Pun.DefaultPool.Destroy ( GameObject  gameObject)

Simply destroys a GameObject.

Parameters
gameObjectThe GameObject to get rid of.

Implements Photon.Pun.IPunPrefabPool.

◆ Instantiate()

GameObject Photon.Pun.DefaultPool.Instantiate ( string  prefabId,
Vector3  position,
Quaternion  rotation 
)

Returns an inactive instance of a networked GameObject, to be used by PUN.

Parameters
prefabIdString identifier for the networked object.
positionLocation of the new object.
rotationRotation of the new object.
Returns

Implements Photon.Pun.IPunPrefabPool.

Member Data Documentation

◆ ResourceCache

readonly Dictionary<string, GameObject> Photon.Pun.DefaultPool.ResourceCache = new Dictionary<string, GameObject>()

Contains a GameObject per prefabId, to speed up instantiation.


The documentation for this class was generated from the following file: