Im learning unity and have hit a road block that I cant figure out. I've searched for answers to this but nothing works for my situation.
I have an PoolManager GameObject (With PoolManager script), that creates the objects used at start. Also I have a LevelGenerator that grabs the inactive objects and sets them to active at the location set in script. LevelGenerator's script contains `public PoolManager theObjectPool`, which I link the PoolManager to in unity.
This system works and objects are created as they should and are set active at the right time. But when I save and reload the scene, nothing spawns and I get a Null Reference Exception. Both the LevelGenerator and the PoolManager are still in scene/active and the objects were created and set to inactive. theObjectPool is still linked with PoolManager.When I delete the PoolManager object and import it back from the prefabs and then relink theObjectPool with PoolManger, the scene works again as it should. The only issue is when the scene reloads or I go from my Main Menu to the game Scene. Any ideas what could cause this issue? Ive tried DontDestroyOnLoad in an Awake Function but didn't work. Also I placed a dubug.log in the PoolManager getPoolObject() function and even with the null reference error, the log shows up. Thank you for reading, let me know if more information is needed.