This commit is contained in:
Janis
2023-02-22 18:43:55 +01:00
parent 50916358f2
commit 5edcd3625b
17 changed files with 3234 additions and 18 deletions

View File

@@ -28,14 +28,13 @@ public class GuiManager : MonoBehaviour
private void Awake()
{
if (instance == null)
if (instance != null && instance != this)
{
instance = this;
}
else
{
Destroy(gameObject);
Destroy(this.gameObject);
return;
}
instance = this;
DontDestroyOnLoad(gameObject);
}
@@ -65,6 +64,10 @@ public class GuiManager : MonoBehaviour
{
OpenPanel(panel);
}
else
{
Debug.Log("Panel not found: " + name);
}
}
public void OpenPanel(GuiPanel panel)
@@ -73,7 +76,7 @@ public class GuiManager : MonoBehaviour
if (!panel.gameObject.activeSelf)
{
panel.gameObject.SetActive(true);
panel.OnClose();
panel.OnOpen();
Debug.Log("Open Panel");
return;
}