Forum rules - please read before posting.

Problem with UI and Escape button

Heya,

I set up my game in 2D and used the Unity UI default set of Menus to go with it. During the game I have some UI that's always enabled, which also stays visible when I press escape to open the pause menu. From the pause menu I can open the options menu. But if I press escape in the options menu to go back to the pause menu, the ingame menu also turns off. This doesn't happen if I just use the back button in the options menu, or press escape in the pause menu to resume the game, so it has something to do with menu's crossfading.

I'm not entirely sure what I need to change to either disable escape as a way to go back one UI layer, or to make sure escape triggers the same actions as the back button does?

Comments

  • In which versions of AC and Unity, exactly?

    The "UI that's always enabled" is the InGame Menu?  And you haven't modified it in any way?  That shouldn't be the default behaviour.  Try setting the Menu's Source temporarily back to Adventure Creator - does it then behave as expected?
  • Unity 2017.2 and AC 1.60.3. I'm not sure how far back it goes.

    I tried setting the Options menu back to AC (it does look a little differently but I don't think I messed with the functionality that much), but it still happens.

    Here are the settings for the menus. I also included the Actionlist Asset that triggers when you click the Options buttons in the Pause menu (and a similar one runs for the Back button on the Options menu). And lastly is the menu that is affected when I press Escape in the Options menu (it turns off). Pressing Escape in the Pause menu does not turn it off (it just resumes the game).

    image


  • So it's a modified InGame menu that you're referring to - that was what I was saying you should switch the Source of.

    But since you've set the Appear type to Manual, but it does not pause the game, then the Pause Menu will turn it off when its Input Key is invoked.

    To get around this, you will need to instead set the Pause Menu's Appear type to Manual, and then create Active Input to turn it on and off with the Menu: Change state Action.  This will give you full control over what is shown vs what is not at all times.
  • Ah amazing. I didn't know about Active Inputs. Once again you thought of everything :)

    I set the Pause menu to manual and created an active input to open and close it. That indeed fixes the UI problem! But it introduces an Input problem:

    I made one active input for normal gameplay (to open the Pause menu), and one active input for when the game is paused (to close the Pause menu or navigate out of any submenus). I set both to use the same button name ("Menu"), but then the pause menu opens and immediately closes.

    So I thought I'd toggle them with Input: Toggle Active, but in the dropdown they are seen as one and the same because they both use the same button name.

    So next I changed the second input to use the "Cancel" button. They're both mapped to Escape so it doesn't help the instant close issue, but this way I could at least use the toggle action to switch between them, BUT, that doesn't seem to work right. Does Toggle Active basically flip the enabled bool? This is what I have when opening the Pause menu (and the reverse when closing it):

    image

    Which works until the pause menu opens and after that the button doesn't do anything.
  • It doesn't flip the bool value - you have to set it directly with the "New state" field.  Your first Input: Toggle active Action should have it checked.

    I think, though, that you may be able to get around the problem altogether by having a brief Engine: Wait Action after turning on the pause Menu.  That'll put it into Cutscene mode, meaning neither input will actually respond.
  • Correct again, the 0.1 second Wait fixed it, thanks for the help!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!