Trouble with menu framework.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
HezoMelo
Posts: 15
Joined: Mon Dec 21, 2020 5:18 pm

Trouble with menu framework.

Post by HezoMelo »

hey,

I have this annoying error when I start the game from the start menu (I am using the menu framework) I am unable to load into my success and defeat scene that I created using the menu system. this however isn't true when I start the game from my gameplay scene then play as then there is no issue whatsoever. the scenes do seem to be transitioning as on the death scene I can still hear the audio clip that's supposed to play but the menu and buttons only seem to come up if I start the game on the gameplay scene.
Last edited by HezoMelo on Tue May 11, 2021 7:14 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trouble with menu framework.

Post by Tony Li »

Hi,

Compare the setup of your Dialogue Manager GameObjects in the start scene and your gameplay scene. Maybe the Standard Scene Scene Transition Manager is set up differently. Keep in mind that the Dialogue Manager GameObject, MenuSystem GameObject, and Save System GameObject (if it's separate from the Dialogue Manager) will survive scene changes, replacing corresponding objects in subsequent scenes such as the gameplay scene.
HezoMobile
Posts: 1
Joined: Wed May 12, 2021 11:46 am

Re: Trouble with menu framework.

Post by HezoMobile »

Hey I checked all my dialogue managers and there seems to be no large difference that could cause this problem. Also I even tried removing the standard scene transition manager completely to no avail. Is this error due to me adding additional scenes using the menu prefab that aren’t part of the original 4 scenes? It seems to change scenes now but does not activate the custom menu system game over and win screen menu items I created.
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trouble with menu framework.

Post by Tony Li »

It's fine to add more scenes.

Are there any errors or warnings in the Console?

What do you mean by "loading into your success and defeat scenes"? Just changing to those scenes, or loading a saved game that was saved in those scenes? If you're just changing scenes, make sure those scenes are in your project's Build Settings > Scenes To Build list.
HezoMelo
Posts: 15
Joined: Mon Dec 21, 2020 5:18 pm

Re: Trouble with menu framework.

Post by HezoMelo »

Hey,

There are no errors or warnings on the console in regards to any pixel crushers assets. what happens is when I change into my additional scenes (Just changing to those scenes)the menu system's newly added "WinScene" panel. I created this win scene by changing the text and menu buttons of the title menu panel. do I possibly need a specific script that activates the win screen panel at runtime? so far I just have a menu system with win scene active on the new screen. also as previously stated if I remove the title screen or just start from the gameplay screen the transition to my new scene happens smoothly and the correct UI appears.
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trouble with menu framework.

Post by Tony Li »

Hi,

Yes, if you added a new panel, you need to add code (or at least hook up a UnityEvent somehow) to show that panel.
HezoMelo
Posts: 15
Joined: Mon Dec 21, 2020 5:18 pm

Re: Trouble with menu framework.

Post by HezoMelo »

is there an easy method or a script that you could provide to accomplish this? as I am not proficient at coding AT ALL lml.
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trouble with menu framework.

Post by Tony Li »

I don't know how your scenes are set up, so I'm taking a guess here. You may need to fiddle around with the code a bit.

Let's say you've added a GameObject named exactly "WinScene" as a child of the MenuSystem, and it's inactive. It has a UIPanel component.

To activate WinScene, you could probably use some code like this:

Code: Select all

using UnityEngine;
using PixelCrushers;
public class ScreenOpener : MonoBehaviour
{
    public void ShowWinScene()
    {
        GameObject winSceneGameObject = GameObjectUtility.GameObjectHardFind("WinScene");
        if (winSceneGameObject != null) // Did we find it?
        {
            UIPanel winSceneUIPanel = winSceneGameObject.GetComponent<UIPanel>();
            if (winSceneUIPanel != null) // Does it have a UIPanel?
            {
                winSceneUIPanel.Open();
            }
        }
    }
}
Post Reply