Forum rules - please read before posting.

Paused menu

Hello community,

I think I have two issues here..

The first one is when I call the inventory menu via appear type -on input key- it always bring the menu no matter what, even when I'm about to change scene or when I interact with a hotspot I can still call the inventory and I don't want that to happen until the interaction finishes completely.

The second issue is, I'm checking -pause game when enabled- however, it pauses the whole game without exceptions.. I wanted to use a sound effect when I open up the inventory menu and when I close it, also some animated camera effects like vignette and blur when opening the menu, but with the pause its not possible and yet I need that pause...

I hope my explanation is clear to you.

«1

Comments

  • Hi there,

    Your Inventory Menu can be called at any time no matter what, because you have not told it otherwise.

    There are many ways to get around this. Here are a few things to try out:

    -Make sure your "scene change" ActionLists are Cutscene gameObjects, instead of pure ActionLists (if that is the case) and set your Active Input to only work when game is: normal.

    -Have a Global Bool Variable which is set to True when interacting with a hotspot and False when not. In your Active Input ActionList, only trigger the opening of the Inventory Menu if set to False.

    -As for the pause game when enabled consider that this action is instantaneous the moment the Inventory Menu is opened. Why not have all your camera effects happen further up your ActionList before calling the Inventory Menu and pausing everything.

    I'm between projects so may have forgotten some details, but hopefully this gives you some areas to investigate.

  • The first one is when I call the inventory menu via appear type -on input key- it always bring the menu no matter what

    Locking a Menu will prevent it from turning on even if its Appear type condition is met. You can lock/unlock a Menu with the Menu: Change state Action.

    However, the better way to selectively deal with input-control over Menus (i.e. to only allow during gameplay) is to switch the Appear type to Manual (so that you have full control) and then detect input with Active Inputs.

    Active Inputs are a way of running ActionLists when input is pressed at a given time - i.e. during normal gameplay, or when paused, etc. See the Manual's "Active Inputs" chapter for more, but essentially you can create an Active Input mapped to the same Input as your menu was, and then run an ActionList that uses a Menu: Change state Action to turn the menu on.

    I wanted to use a sound effect when I open up the inventory menu and when I close it, also some animated camera effects like vignette and blur when opening the menu, but with the pause its not possible and yet I need that pause...

    Menu sounds are played via the "Default Sound" object you define in the Scene Manager. You can check Play while paused? to have it work when a pause menu is enabled.

    For animation, you can set an Animator component's Update Mode to Unscaled Time to have it continue to play when the game is paused.

  • Thanks @JackAnimated and @ChrisIceBox for the answers.

    I've decided to use the active input to call the menu, I've set the menu to manual and everything is great. However, when I call the inventory using active input I can't go back from it, it remains stuck, for example if I pressed "shift" to open the menu I cannot press "shift" again to close it.. It only works when I uncheck the -pause game when enabled- but with the pause I cannot do it..

  • When using this method, you have to define everything explicitly. Having an Active Input to turn the Menu on won't work in reverse automatically - you'll have to instruct it to be able to turn it off as well.

    Active Inputs are limited by the game state, so if the game is paused when the Menu is turned on, you'll need to define a separate Active Input that responds in Pause mode. This can be used to turn the Menu off. It can rely on the same "shift" input that you defined in the Input Manager.

  • That worked like a charm.

    Thanks Chris!

  • I got something, I noticed that under -InventoryBox- the highlighted texture does not show on an empty slot.. there is only a sound but no texture.. is it possible to have the highlighted texture appear on them as well?

    Also, can I manage to navigate the menu using different inputs then the original horizontal and vertical? Because I'm using the analog stick to move my character but I don't want to use the analog stick to navigate the menu, preferable choice would be to use the D-pad for the menus..

  • One more thing.. I've set up a sound effect whenever I turn on the menu, I also set up a hover sound under the -InventoryBox-. However, the issue is that the hover sound always work when I turn the menu on (when there is an item in the inventory) which interferes with the sound effect that I set up when turning the menu on.. It would be better if the hover sound works only when navigating..

  • edited April 22

    is it possible to have the highlighted texture appear on them as well?

    This is a feature that will be included in v1.71.

    can I manage to navigate the menu using different inputs then the original horizontal and vertical?

    If your Menu is rendered with Unity UI, you can define what inputs are used for navigation in your EventSystem.

    A custom EventSystem prefab can be assigned in the Menu Manager.

    It would be better if the hover sound works only when navigating..

    Is this a Unity UI menu or an AC menu, and is this only when your directly-navigating the menu?

  • If your Menu is rendered with Unity UI, you can define what inputs are used for navigation in your EventSystem.

    My menu is AC, is there an alternative way than the event-system?

    Is this a Unity UI menu or an AC menu, and is this only when your directly-navigating the menu?

    I'm using AC menu, it's more convenient and easier.
    When I open up the menu and I have items in my inventory, you can hear the hover sound immediately working..

  • edited April 23

    My menu is AC, is there an alternative way than the event-system?

    This script, placed in the scene, will force use of inputs named "Alt_Horizontal" and "Alt_Vertical" when the Inventory menu is open:

    using UnityEngine;
    using AC;
    
    public class OverrideMenuInput : MonoBehaviour
    {
    
        private void Start ()
        {
            KickStarter.playerInput.InputGetAxisDelegate = MyGetAxis;
        }
    
        private float MyGetAxis (string axisName)
        {
            if (axisName == "Horizontal" || axisName == "Vertical")
            {
                Menu inventoryMenu = PlayerMenus.GetMenuWithName ("Inventory");
                if (inventoryMenu.IsOn ())
                {
                    axisName = "Alt_" + axisName;
                }
            }
    
            try
            {
                return Input.GetAxis (axisName);
            }
            catch {}
            return 0f;
        }
    
    }
    

    I'm using AC menu, it's more convenient and easier.

    Is it when you are directly navigating it? And does it pause the game when enabled?

  • edited April 23

    This script, placed in the scene, will force use of inputs named "Alt_Horizontal" and "Alt_Vertical" when the Inventory menu is open:

    thanks for the sctipt Chris, but I have more than one menu, would it work on all of them or do I have to define each one?

    Wouldn't it be easier if we just edit the main script which navigates the menu and change the input to a custom one from there? Just like the ones in the setting manger under -available inputs- there is Horizontal, Vertical and also CursorHorizontal and CursorVertical.. Can we set something like MenuHorizontal and MenuVertical ? :)

  • Is it when you are directly navigating it? And does it pause the game when enabled?

    Yes, and yeah it is set to pause.. here is a video to help explain the issue.

    https://youtube.com/watch?v=3XT4Vswpzak

    You can see that the hover sound works on start as I open up the menu everytime, It would be better if it worked only when navigating and not on start...

  • I'll look into it.

  • Awesome update Chris! The hover sound is working perfectly now!

    But I cannot locate the "Option to display an InventoryBox element's Highlight texture if a slot is empty"

  • Also any news about navigating the menu using different "horizontal" and "vertical" than the ones for the movement?

  • I cannot locate the "Option to display an InventoryBox element's Highlight texture if a slot is empty"

    It's the Highlight empty slots? property int he InventoryBox element itself. It's only available for AC menus, however.

    Also any news about navigating the menu using different "horizontal" and "vertical" than the ones for the movement?

    I'm still considering how to expose this as an option, but here's a modified version of the script above to work whenever the game is not in gameplay mode, or if direct menu-navigation is enabled:

    using UnityEngine;
    using AC;
    
    public class OverrideMenuInput : MonoBehaviour
    {
    
        private void Start ()
        {
            KickStarter.playerInput.InputGetAxisDelegate = MyGetAxis;
        }
    
        private float MyGetAxis (string axisName)
        {
            if (axisName == "Horizontal" || axisName == "Vertical")
            {
                if (!KickStarter.stateHandler.IsInGameplay () || KickStarter.playerInput.canKeyboardControlMenusDuringGameplay)
                {
                    axisName = "Alt_" + axisName;
                }
            }
    
            try
            {
                return Input.GetAxis (axisName);
            }
            catch {}
            return 0f;
        }
    
    }
    
  • I'm still considering how to expose this as an option, but here's a modified version of the script above to work whenever the game is not in gameplay mode, or if direct menu-navigation is enabled:

    Thank you for the script Chris! Its working as expected! :)

    It's the Highlight empty slots? property int he InventoryBox element itself. It's only available for AC menus, however.

    Please check the picture, I don't think I see Highlight empty slots? anywhere..

    I'm using AC menu

    https://imgur.com/ghRzVHy

  • You must have Items can be re-ordered in menus? in the Settings Manager for it to show.

  • Much appreciate it Chris!

  • I have encountered a problem with the menu..

    When I open up my inventory menu (that is set to pause game when enabled) and clicked on an item to open up another menu the hover sound lags and keeps repeating..

    here is a video to help explain the issue.

    https://youtu.be/2C8am9-Q15U

    (the sound might be a bit loud)

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.