November 2019
Intermediate to advanced
404 pages
12h 9m
English
The following class definition allows us to perform a simple hands-on test with the PrefabPoolingSystem class; it will support three Prefabs and prespawn five instances of each during application initialization. We can press the 1, 2, 3, or 4 keys to spawn an instance of each type and then press Q, W, E, and R to despawn a random instance of each type, respectively:
public class PrefabPoolingTestInput : MonoBehaviour { [SerializeField] GameObject _orcPrefab; [SerializeField] GameObject _trollPrefab; [SerializeField] GameObject _ogrePrefab; [SerializeField] GameObject _dragonPrefab; List<GameObject> _orcs = new List<GameObject>(); List<GameObject> _trolls = new List<GameObject>(); List<GameObject> _ogres = new List<GameObject>(); ...Read now
Unlock full access