November 2019
Intermediate to advanced
404 pages
12h 9m
English
There is one important caveat to this system that has not yet been mentioned: the PrefabPoolingSystem class will outlast the scene's lifetime since it is a static class. This means that when a new scene is loaded, the pooling system's dictionaries will attempt to maintain references to any pooled instances from the previous scene, but Unity forcibly destroys these objects regardless of the fact that we are still keeping references to them (unless they were set to DontDestroyOnLoad()), and so the dictionaries will be full of null references. This would cause some serious problems for the next scene.
We should, therefore, create a method in PrefabPoolingSystem that resets the pooling system in preparation for ...
Read now
Unlock full access