The default implementation of a PrefabPool for PUN, which actually Instantiates and Destroys GameObjects but pools a resource. More...
Inherits 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... | |
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.
void Destroy | ( | GameObject | gameObject | ) |
Simply destroys a GameObject.
gameObject | The GameObject to get rid of. |
Implements IPunPrefabPool.
GameObject Instantiate | ( | string | prefabId, |
Vector3 | position, | ||
Quaternion | rotation | ||
) |
Returns an inactive instance of a networked GameObject, to be used by PUN.
prefabId | String identifier for the networked object. |
position | Location of the new object. |
rotation | Rotation of the new object. |
Implements IPunPrefabPool.
readonly Dictionary<string, GameObject> ResourceCache = new Dictionary<string, GameObject>() |
Contains a GameObject per prefabId, to speed up instantiation.