I have two scenes, The first one called "Boot" contains and ObjectPoller class that instantiates all GameObject in the game and disable them. I made it a singleton with "don't destroyOnLoad" attribute. In the the second scene called GamePlay, There is a LevelManager that get acces to the ObjectPooler of the first scene by a function called GetPooledObject. When I boot the game by the first scene (Boot) in the Unity editor, everything works fine. But when I boot the game by the second scene, Unity editor freezes completely. I can't even shut it down. I'm do ctrl + Alt+delete to stop Unity. Is there any logic to prevent this behaviour?
// in the ObjectPooler file
private PoolInfo GetPoolByType(PoolObjectType type)
{
for (int i = 0; i < allPoolObjectList.Count; i++)
{
if (type == allPoolObjectList[i].type)
return allPoolObjectList[i];
}
return null;
}
// In the LevelManager
private void Spawn(BlocType _type)
{
if (ObjectPooler.Instance != null)
{
Bloc b = ObjectPooler.Instance.GetPooledBloc(_type);
if (b)
{
// logic
}
}
}