当我单击GameScene上获胜或失败面板的OK按钮时,它将带我回到MenuScene并显示标题屏幕而不是级别选择屏幕。 在更改场景之前缺少对面板的引用,我该如何保持它们通过它们?
StartManager
public GameObject startPanel, levelPanel;
// Start is called before the first frame update
void Start()
{
startPanel.SetActive(true);
levelPanel.SetActive(false);
}
public void PlayGame()
{
startPanel.SetActive(false);
levelPanel.SetActive(true);
}
public void Home()
{
startPanel.SetActive(true);
levelPanel.SetActive(false);
}
我希望levelPanel处于活动状态
答案 0 :(得分:0)
public GameObject startPanel, levelPanel;
public static bool OpenLevelPanel;
// Start is called before the first frame update
void Start()
{
// Check OpenLevelPanel Bool Setting That;
startPanel.SetActive(!OpenLevelPanel);
levelPanel.SetActive(OpenLevelPanel);
}
public void PlayGame()
{
startPanel.SetActive(false);
levelPanel.SetActive(true);
}
public void Home()
{
startPanel.SetActive(true);
levelPanel.SetActive(false);
}
在按钮上单击确定
StartManager.OpenLevelPanel = true;
//Switch Scene...