Page 1 of 2

Menu framework

Posted: Sun Jul 24, 2022 6:18 am
by hrohibil
Hello

Simple question.

Where is the pause menu related to the menu framework? How do I call it.

Re: Menu framework

Posted: Sun Jul 24, 2022 8:43 am
by Tony Li
Hi,

In desktop/console games, you would normally press the input defined in the Menu System's Pause component. By default, it's set to "Cancel", which is usually mapped to the Escape key.

However, in mobile games you can't normally press keyboard keys or joystick buttons. Instead, do this:

1. Save a prefab variant of your Menu System. Add a UI button to it. Let's call it "PauseMenuButton". Configure the UI button's OnClick() to call PausePanel.Open.

2. Configure the TitleMenuPanel's OnOpen() event to deactivate PauseMenuButton. Configure its OnClose() event to activate PauseMenuButton.

3. Configure the PauseMenu's OnOpen() event to deactivate PauseMenuButton. Configure its OnClose() event to activate PauseMenuButton.

Re: Menu framework

Posted: Sun Jul 24, 2022 9:11 am
by hrohibil
Ok Tony

I followed the steps.
In title menu it works, but when i clik start and go to level1, i dont have the pausebutton UI?
Do i add the Menu prefab variant to the scene? I tried added it but then the menubuttons are visible ?

Re: Menu framework

Posted: Sun Jul 24, 2022 9:16 am
by Tony Li
Your Menu System prefab variant should be in the MainMenu scene. In this instance, set the PauseMenuButton inactive.

You can also put an instance in your gameplay scene if you want. If you put it in your gameplay scene, set the instance's TitleMenu inactive and PauseMenuButton active.

Make sure PauseMenuButton is inside the Menu System prefab variant's hierarchy.

Re: Menu framework

Posted: Sun Jul 24, 2022 9:25 am
by hrohibil
Hi Tony


This is what my prefab variant looks like.
It is indeed in the main scene.

I dont understand what you mean with " In this instance, set the PauseMenuButton inactive" Are you saying that on the PauseMenuButton it self I should change the pausepanel Onclik to Deactivate?

EDIT:
2 issues when i drag a menu variant to the gameplay.

1:
Even if deactivate all gameobjects except the pausemenu button, when pressing start, the main menu START button is still visible

2:
It seems like i am fighting over canvas sorting? Either i can click on the UI buttton, but then i dont have mobile UI controls or the other way around??


Re: Menu framework

Posted: Sun Jul 24, 2022 9:44 am
by Tony Li
Do not make the PauseMenuButton a child of TitleMenu. Make it a direct child of the Menu System.

Re: Menu framework

Posted: Sun Jul 24, 2022 9:54 am
by hrohibil
Thanks.
I did that.

And now it works when I launch game from main menu :-)
Thanks Tony.


Now its only from level1 if i play i am not sure how to put it correctly

Re: Menu framework

Posted: Sun Jul 24, 2022 9:56 am
by hrohibil
Fixed it...
You are the KING!!!!
Thank you

EDIT:

Do you have a tutorial on how to setup the whole save / load system with invector..

Re: Menu framework

Posted: Sun Jul 24, 2022 11:37 am
by Tony Li
Set up the save system here.

Then add the scripting define symbol USE_INVECTOR_INVENTORY as indicated here. Add InvectorStatsSaver and InvectorInventorySaver components to your player, and assign unique keys (e.g., "playerStats" and "playerInventory").

Re: Menu framework

Posted: Sun Jul 24, 2022 11:51 am
by hrohibil
Ok i set it up.

In gameplay I made two saves and they show up in the panel, but when i press on any of them, the scenes reload back to initial start NOT the saved game.

Yes i also did add the ReloadWhenDead script..