Menu Framework Load Scene

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
dnblank12
Posts: 14
Joined: Wed Sep 21, 2022 5:46 am

Menu Framework Load Scene

Post by dnblank12 »

Hi, I'm having an issue, I'm not sure if its unity in general issue or the menu framework, if I load Menu then Scene 1 again and again, afterwards the game froze, and I checked the profiler this shows (im new to profiler so idk)
Attachments
profiler.png
profiler.png (95.96 KiB) Viewed 221 times
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Menu Framework Load Scene

Post by Tony Li »

Hi,

There may be something in your Scene 1 that isn't cleaning up after itself or is getting into an infinite loop.

You could temporarily eliminate the Menu Framework from the possibilities by replacing the main menu scene with a small test scene that has a UI button to load Scene 1, and then add a UI button to Scene 1 that loads the main menu scene.

In fact, you could eliminate the Dialogue System's save system, too, by configuring the button to call SceneManager.Loadscene(), such as in this script:

Code: Select all

using UnityEngine;
using UnityEngine.SceneManagement;

public class BasicSceneLoader : MonoBehaviour
{
    public void LoadScene(string sceneName) // <-- Configure UI button's OnClick() to use this.
    {
        SceneManager.LoadScene(sceneName);
    }
}
If that works, try replacing SceneManager.LoadScene(sceneName) with:

Code: Select all

PixelCrushers.SaveSystem.LoadScene(sceneName);
This will involve the save system but not the Menu Framework.
dnblank12
Posts: 14
Joined: Wed Sep 21, 2022 5:46 am

Re: Menu Framework Load Scene

Post by dnblank12 »

Hi, I tried it on a new empty project, and used the code you suggested, and the issue is still there. I tried another profiler with deep profile (for some reason the first post screenshot didn't show it)
Attachments
profiler2.png
profiler2.png (210.86 KiB) Viewed 215 times
dnblank12
Posts: 14
Joined: Wed Sep 21, 2022 5:46 am

Re: Menu Framework Load Scene

Post by dnblank12 »

Code: Select all

        public virtual void ReturnToTitleMenu()
        {
            SaveSystem.BeforeSceneChange();
            SaveSystem.LoadScene("index:" + FindObjectOfType<TitleMenu>().titleSceneIndex);
            //SaveSystem.sceneLoaded += OpenTitleMenuOnSceneLoaded;
        }

        private void OpenTitleMenuOnSceneLoaded(string sceneName, int sceneIndex)
        {
            //SaveSystem.sceneLoaded += OpenTitleMenuOnSceneLoaded;
            FindObjectOfType<TitleMenu>().titleMenuPanel.Open();
        }
so I comment out the SaveSystem.sceneLoaded += OpenTitleMenuOnSceneLoaded and it actually worked.
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Menu Framework Load Scene

Post by Tony Li »

Thank you for the info. I’ll check the original Menu Framework code to make sure it’s properly using “-=“ to unhook.
Post Reply