- Home /
Question is off-topic or not relevant
What is the code to load a panel that is not a buildIndex scene?
Hi,everyone! I am creating a save/load system for my game and I have a MainMenu screen that has a settings menu,in the settings menu there's an button called:Save Files,that button should load the loadfilePanel that contains the load files you created,but I tried to use:SceneManager.LoadScene("LoadPanel"); I discovered that this is used to load scenes and not panels. What is the correct code for me to use in this situation?
Answer by swanne · May 13, 2020 at 04:18 PM
Hi. I recommend having the loadfilePanel object disabled at Start and then enabling it when you need it. You can use a CanvasGroup to create a cool fade in and out with the alpha settings.
These 2 lines make my main canvas (player HUD) inactive and bring up my pause menu. You can make these game objects public so you can assign them in the inspector, or you can get them by code on wake or start.
mainCanvas.gameObject.SetActive(false);
menuCanvas.gameObject.SetActive(true);
Hope that helps :)