Forum rules - please read before posting.

Inventory open/close button disappears after pause menu

Newbie question, I'm still learning the interface and not really a coder but I'm catching on thanks to all the tutorials and videos.  My issue - I created a button that opens and closes the inventory menu.  It works properly in that I click the button and the inventory opens, click again and it closes.  My issue is that when I click the Menu button that brings up the Pause menu for saving, resuming, options, etc, then I resume the game, my inventory button disappears from the scene.  I'm hoping I'm just missing something obvious.

Comments

  • Figured it out.  I was using a toggle variable and had menu 'Appear type' set to manual.  I changed it to 'During Gameplay'.
  • edited December 2019

    Hi Chris:)
    I have the same issue. When I resume the game, the inventory button (along with other menus that I have in my game) disappears from the scene. All Back buttons in the Pause menu are set to Crossfade (I think this is the case). Sure I can set Appear Type to During Gameplay for my inventory menu and all other menus in my game but the thing is that at some point of my game I want to hide different menus with action Menu: Turn On/Off Menu.

    But this action is not working if I will setup Appear Type to During Gameplay.
    Any idea of how this can be fixed?

  • Two ways:

    1. A Menu with an Appear type of During Gameplay can be hidden from view by locking it with the Menu: Change state Action. A locked Menu will not display even if its Appear Type condition is met.
    2. Replace the Crossfades with ActionLists that use series of Menu: Change state Actions to turn on/off exactly which Menus you want to affect.
  • edited December 2019

    Actually, I did both before posting this here but thought that there is another way. Thank you Chris. I think the first one is "less heavy" because telling the truth I want to get rid of a big amount of actionlists for pause menu buttons. What do you think is a more practical way?

  • Through scripting, you could hook into the OnExitGameState custom event to manually turn the Menu back on when the game comes out of Pause mode:

    using UnityEngine;
    using AC;
    
    public class EnableMenuExample : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnExitGameState += ExitGameState;
        }
    
    
        private void OnDisable ()
        {
            EventManager.OnExitGameState -= ExitGameState;
        }
    
    
        private void ExitGameState (GameState _gameState)
        {
            if (_gameState == GameState.Paused)
            {
                PlayerMenus.GetMenuWithName ("MyInventoryMenuName").TurnOn ();
            }
        }
    
    }
    
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.