expressobits / Pools

Create Simple and Easy Pool of objects! This extension creates easy use of Pool with objects that are instantiated and destroyed, avoiding excessive use of memory and processing.
http://www.expressobits.com.br
MIT License
7 stars 1 forks source link

Problem in change scene #6

Closed scriptsengineer closed 3 years ago

scriptsengineer commented 5 years ago

I created a simple button that allows to change between two similar scenes, where the pools are maintained, since these are static, however it was seen a problem and error with this:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. ExpressoBits.PoolSimply.Pool.OnPoolerEnable (UnityEngine.GameObject obj) (at Assets/3rd-Party/Expresso Bits/PoolSimply/Scripts/Pool.cs:102) ExpressoBits.PoolSimply.Pool.Dequeue (UnityEngine.GameObject prefab) (at Assets/3rd-Party/Expresso Bits/PoolSimply/Scripts/Pool.cs:59) ExpressoBits.PoolSimply.Pool.Dequeue (UnityEngine.GameObject prefab, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation) (at Assets/3rd-Party/Expresso Bits/PoolSimply/Scripts/Pool.cs:65) ExpressoBits.PoolSimply.Pools.Instantiate (UnityEngine.GameObject prefab, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation) (at Assets/3rd-Party/Expresso Bits/PoolSimply/Scripts/Pools.cs:31) ExtensionMethods.InstantiateInPool (UnityEngine.MonoBehaviour value, UnityEngine.GameObject gameObject, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation) (at Assets/3rd-Party/Expresso Bits/PoolSimply/Scripts/ExtensionMethod.cs:15) Spawn.Fire () (at Assets/3rd-Party/Expresso Bits/PoolSimply-DemoScene/Scripts/Spawn.cs:23) Resolutions:

scriptsengineer commented 3 years ago

Change to static classes resolve problem #b83096