Forum rules - please read before posting.

Question about navigate menus directly with controller

Hi everyone,
AC 1.70.0 + Unity 2019.2.17f1 on a 2d game.

I'm trying to use controller also to navigate on the menus. Actually I map the CursorHorizontal and Vertical and Vertical and Horizontal, to use in "Direct" mode with "Keyboard or controller" input. Now in menu manager I checked Directly-navigate menus when paused and, in the menus (ex. pause menu in Unity Ui Prefab) I set the first element (in my case resume button).
I mapped also the button to call the the pause menu with controller, and this works correctly.

But once the pause menu is open, how can I move inside the menu? Now I can only open the menu, but not move inside, also if I press the button or direction I mapped (CursorHorizontal and vertical and Horizontal and Vertical). Are there some other input I have to map to moving inside menus?

Thank you.

«1

Comments

  • edited August 2020

    CursorHorizontal and CursorVertical are necessary to navigate AC-based menus.

    To navigate Unity UI menus, you need to rely on the inputs defined in the Event System - which by default are Horizontal and Vertical.

    You'll also need to make sure that the "Navigation" sections of each of your UI Button components are configured to allow for naviation - though this is normally just a case of leaving them at their default "Automatic" value.

  • Hello Chris,
    I tried the direct navigation menu but without luck.
    I start with the settings I set:

    • movement method: Point and Click
    • Input method: keyboard or controller

    Menu manager:https://drive.google.com/file/d/1a3gn5Pv6GWqlKrN8Ml6zPI-WjchXdYvr/view?usp=sharing

    • Menu manager: Directly-navigate menus when paused? checked
    • Menu manager: Directly-navigate menus during Conversations? checked
    • Auto-select valid UI raycasts? checked
    • Pause menu: Auto-select first visible element? checked

    Inputs:
    I have 2 Horizontals: one set on keyboard and the other one for Joystick. For joystick is 6th axis (D-Pad), gravity 3, Dead 0.001, Sensitivity 3, Snap checked.
    I have 2 Verticals: one set on keyboard and the other one for Joystick. For joystick is 7th axis (D-Pad), gravity 3, Dead 0.001, Sensitivity 3, Snap checked.

    With these settings I can open the pause menu but I can't navigate on it. So I made another step:

    • On the TurnOn Action list of Pause Menu I changed "When running" from "Pause Gameplay" to "Run in Background". I tried also Pause Gameplay with Unfreeze "pause" Menus checked and it seems to have the same behaviour of Run in background, but i don't know if it's correct.

    With these settings I have can open the pause menu but I have this issues:

    • When Pause Menu opens it seems to detect where the cursor is and if a menu button is on the cursor, also the button is select adding to the first element of the menu: https://drive.google.com/file/d/1nSPEWX7dHjEtQYNHF4y_BvNcAWYoDw3x/view?usp=sharing
    • I can navigate in the menu, but I can press the button only with Interaction B button and not with InteractionA Button, while I'd like to have the second one or both.
    • I can navigate the first to button (Resume and Save game), but if I press down button on D-pad again the selection disappeares. To go to Load game Button from resume button I have to press down (Save game) right, down, up. In this case it jump from Save game button to Quit button. But when I press up button from quit button, I can go to Resume without problem.

    Here the load button UI inspector. It set on aurtomatic like the other ones: https://drive.google.com/file/d/10YjfNu2ytx9Lnh-LbdZ_2gBj0f0jgOFe/view?usp=sharing

    And here the load button in the AC menu: https://drive.google.com/file/d/1OhUFzKRzNxKYPtQ_BXL0seHXRIhoe2G_/view?usp=sharing

    The good news is that I can navigate on conversations menu without problems.

  • With these settings I can open the pause menu but I can't navigate on it.

    v1.71.6 fixed an issue related to the direct-navigation of Unity UI-based Pause menus. In a backup/duplicate project, try the latest release.

    When Pause Menu opens it seems to detect where the cursor is and if a menu button is on the cursor

    This is likely due to the Auto-select valid UI raycasts? option - this relates to the cursor, so uncheck this for direct-control.

    I can navigate in the menu, but I can press the button only with Interaction B button and not with InteractionA Button, while I'd like to have the second one or both.

    With Unity UI, it's down to the inputs listed in the Event System. By default, interactions are made with the Submit button.

    I can navigate the first to button (Resume and Save game), but if I press down button on D-pad again the selection disappeares. To go to Load game Button from resume button I have to press down (Save game) right, down, up. In this case it jump from Save game button to Quit button.

    The navigation between elements in a Unity UI menu is handled by Unity UI - not AC. For exact control, set Navigation to Explicit and configure the fields beneath.

    I can't navigate on the inventory menu. I can open it but don't navigate.

    Direct-control over gameplay menus is disabled by default. You can enable it with the Engine: Manage systems Action - this is best placed in a background ActionList set to run when the Menu turns on.

  • Thank you Chris, I made a lot of progress with your tips, but I have some other little (I hope) issues:
    1. You suggested to upgrade to 1.71.6 to fix that issue. But if I use the option When running in Pause Gameplay (in the action in turn on menu) without the check on Unfreeze "pause" Menus? or Run in background it solves the issue. Is this a wrong method? Could it have side effects when I'm in not in directly navigate menus mode (Actually I can change the options from mouse to controller, when I'm in mouse mode I want to navigate freely, while when I'm in controller mode I'd like to navigate directly in menus).

    1. I change the submit input on joystick button 2, so now I can press the X button to press the button and work perfectly. With your suggestions for Inventory (Add Engine:Manage system, enabled Direct-nav in game menus) I can open the inventory and with left/right D-pad I can navigate on inventory. But I have some issues:
    1. I can't navigate on title menu. This menu is open when I start the game, in a scene that open this menu in a custscene_OnStart action. Here the settings for AC https://drive.google.com/file/d/1WoN7Q5nrDfteVn3uBWnFfjisaxTR0Yxt/view?usp=sharing
      and the UI in Unity: https://drive.google.com/file/d/1MsP3N_ELOPIB3ebPi04rD6dXY2M6qyfU/view?usp=sharing
      Linked to this type of menu: how is the behaviour when I have a left*righ menu (ex. language at the end). I have to go to the le dt or right button and click or is there a way to slide the options righ/left more easily?

    2. Same issue with OptionNew menu. This is a menu I can access to pause menu. But when I click on the button Options, it open correctly the OptionsNew menu, but I can't navigate, like if it can't recognized any button I set on as first-element.
      Here the OptionsNew AC settings: https://drive.google.com/file/d/1DDQcrf_MoLaqysmSiMZsIs3ojukuCNMl/view?usp=sharing
      and Unity UI: https://drive.google.com/file/d/19nSYW7YppzvRp99kohWoCfe37R2YwsC5/view?usp=sharing
      Could the toggle options, slide left/right, or speech, music, sfx volume create some issues?

    Sorry for the lenght of the post and thank you.

  • if I use the option When running in Pause Gameplay (in the action in turn on menu) without the check on Unfreeze "pause" Menus? or Run in background it solves the issue.

    Gameplay-blocking ActionLists can be an issue with Menus as they turn on, so running it in the background is recommended.

    the name of the objects in inventory appears on the center of the screen (where there's the cursor), and not on the objects in the inventory

    If your Inventory item names are displayed in the Hotspot menu, then it's down to the "Position type" setting of that Hotspot menu. Setting it to "On Hotspot" should have it appear over selected items.

    when I click with the X button to select the object in inventory, it closes the inventory and open the pause menu, so I can't select any objects.

    The default Pause menu is set to open when an Input named "Menu" is pressed. Is your X button mapped to this Input?

    I can't navigate on title menu.

    From your screenshot of the Canvas's Inspector, it looks like you have a Slider element attached to its root. Is this linked to any Element in the Menu Manager? Keep your Interactive components off the root, it may be interfering with the selection process.

    Also, if your Continue button is dyanamic (i.e. isn't always visible), check Auto-select first visible element? instead.

    Linked to this type of menu: how is the behaviour when I have a left*righ menu (ex. language at the end)

    What do you want the behaviour to be? If you want to be able to select the "Language" field, and then press left/right to switch language without pressing X, you'll have to add a bit of simple scripting. First make the Language a Button so that it can be selected. You'll then need to attach scripts to both arrow buttons that change the language when selected, and then re-select the Language button afterwards. I'll see if I can share some sample code next week.

    Same issue with OptionNew menu.

    Is the element you enter into the "First selected element" actually selected upon being turned on?

    As this too is a pause menu, it may be that the latest release fixes the issue.

    Could the toggle options, slide left/right, or speech, music, sfx volume create some issues?

    Shouldn't do - the default Options menu features those and I have no issues directly-navigating them.

  • edited September 2020

    Thanks Chris. In these days I'll try the upgrade to 1.71.6 to solve some issues (Title menu and OptionsNew menu), but I tried to solve the inventory issues, but I'm not lucky.

    If your Inventory item names are displayed in the Hotspot menu, then it's down to the "Position type" setting of that Hotspot menu. Setting it to "On Hotspot" should have it appear over selected items.

    I checked the hotspot menu and Position was set on Follow Cursor (https://drive.google.com/file/d/16OteF_TNJPzJqxoCh7Kq0SCCwFKWPdlv/view?usp=sharing). But if I change it in On Hotspot it seems ok but if I have 3 objects in inventory I can navigate on 1,2,3 and again on empty slots, and, if my cursor is on a screen hotspot, the name of the hotspot appear down in inventory (in the empty slot). I think it's ok if it's not possible select empty slot, but how it's possible (actually this is an AC menu).

    The default Pause menu is set to open when an Input named "Menu" is pressed. Is your X button mapped to this Input?

    I checked but the Menu input is mapped with joystick button 7 (so the start menu of the d-pad). I have the same issue with X-button and A-button (the two buttons I mapped for InteractionA and InteractionB). Pratically, when the inventory is open if I press X o A I obtain the same result: they open the Pause menu and don't select the inventory objects.

  • if my cursor is on a screen hotspot, the name of the hotspot appear down in inventory (in the empty slot)

    That shouldn't happen, though it may be another issue since fixed.

    In any case, if you want the Hotspot menu to appear above the cursor during regular gameplay, you can rely on two Hotspot menus - one for gameplay, one for inventory, each with different "Position types" - and only have one unlocked at a time.

    When your Inventory menu turns on/off, you can run a pair of Menu: Change state Actions that lock one and unlock the other. When a menu is locked, it will be prevented from turning on even when its "Appear type" condition is met.

    when the inventory is open if I press X o A I obtain the same result: they open the Pause menu and don't select the inventory objects.

    There's no alternative button for Menu? What is the Pause menu's "Appear type" set to? Does it no longer turn on if you set it to "Manual"?

    I'm not sure why you'd be getting this problem, but assuming the above works, you can instead rely on Active Inputs to control the Pause menu's display. Active Inputs allow you to run ActionLists when an input is pressed - so one mapped to "Menu" could e.g. check if the Pause menu is open, and turn it on if not.

    See the Manual's "Active Inputs" chapter for more on this topic.

  • edited September 2020

    On the topic of being able to cycle through languages by going left/right:

    Detach your Languages element from the Menu Manager, make sure its a Button in your UI Canvas, and create two Buttons (for each arrow) beside it.

    Set this Button's Navigation to Explicit, and make assign the two arrow Buttons in its "Left" and "Right" directions.

    Attach the script below to the Language Button's Text component:

    using UnityEngine;
    using UnityEngine.UI;
    
    namespace AC
    {
    
        public class DisplayLanguage : MonoBehaviour
        {
    
            private void OnEnable ()
            {
                OnChangeLanguage (0);
                EventManager.OnChangeLanguage += OnChangeLanguage;
            }
    
            private void OnDisable ()
            {
                EventManager.OnChangeLanguage -= OnChangeLanguage;
            }
    
            private void OnChangeLanguage (int language)
            {
                GetComponent <Text>().text = Options.GetLanguageName ();
            }
        }
    
    }
    

    Next, set the Navigation of your two arrow buttons also to Explicit. Set the button on the left to select Languages when navigating right, and the button on the right to select Lanaguages when navigating left.

    Then attach this script to both, checking "Go Forward" on the one on the right.

    using UnityEngine;
    using System.Collections;
    using UnityEngine.EventSystems;
    using UnityEngine.UI;
    
    namespace AC
    {
    
        public class CycleLanguage : MonoBehaviour, ISelectHandler
        {
    
            public bool goForward;
    
            public void OnSelect (BaseEventData eventData)
            {
                int language = Options.GetLanguage ();
                Selectable selectable = null;
    
                if (goForward)
                {
                    language ++;
                    if (language >= KickStarter.speechManager.languages.Count) language = 0;
                    selectable = GetComponent <UnityEngine.UI.Button>().FindSelectableOnLeft ();
                }
                else
                {
                    language --;
                    if (language < 0) language = KickStarter.speechManager.languages.Count - 1;
                    selectable = GetComponent<UnityEngine.UI.Button> ().FindSelectableOnRight ();
                }
    
                Options.SetLanguage (language);
                StartCoroutine (Select (selectable));
            }
    
    
            private IEnumerator Select (Selectable selectable)
            {
                yield return new WaitForEndOfFrame ();
                selectable.Select ();
            }
    
        }
    
    }
    
  • Hello Chris, thanks for the help. I upgraded to 1.71.8 but I have still issues. I start with the first one, without to put all the issues, otherwise I think it's more complicate to solve. I start with the first one (the navigation on the title menu), when it solves I pass to the second one and so on (if you are agree).

    The first one is linked to the Title Menu. In the first scene of my game I have a simple video (loaded with videoplayer), then I change scene to the title screen. On Scene cutscenes I have a OnStart one where, on the various actions, I have a Menu/Change state/Turn On Menu/Title.
    Here the settings of the menu AC and Unity:
    https://drive.google.com/file/d/1WoN7Q5nrDfteVn3uBWnFfjisaxTR0Yxt/view?usp=sharing (I change the first selected Element to NewGameButton so I'm sure this element is always active)
    https://drive.google.com/file/d/1MsP3N_ELOPIB3ebPi04rD6dXY2M6qyfU/view?usp=sharing (with explicit I managed the connections between the element).

    When I open the Title menu, on ActionList when turn on, I have an Action List to deselect inventory item and this Action is set Run in background in the When running options.

    With this settings, when I start the scene Title, I can't navigate directly, but, if I click for example on Help Menu (and in this menu I can navigate directly), where there's only a back button (all the other elements are images and words) and click on Back Button, it return on the Title menu, and, this time, the menu is directly navigable, also if there's another issue: the controller cursor can select another button (so I can see two button selected and the cursor has the priority). Same thing when I enter to Load Menu and click back button. When I return to Title menu it's navigable.
    The Load back button as The Help Menu back button are simply a TurnOffMenu.

    The only menu I can access to Title Menu (or pause menu) and it's not navigable is OptionNew menu, but this is the second issue.

  • Is the "New Game" button selected, at least?

    As your menu does not pause the game, you will need to use the Engine: Manage systems Action to allow for direct-navigation of in-game Menus.

    You'll need to make sure that this is run before the Menu itself is turned on.

  • Is the "New Game" button selected, at least?

    When I come back from internal menu (ex. Load or help menu), it's correctly selected, but when the scene starts, it's not selected.

    As your menu does not pause the game, you will need to use the Engine: Manage systems Action to allow for direct-navigation of in-game Menus.

    You'll need to make sure that this is run before the Menu itself is turned on.

    I try now and I update you

  • I tried putting Engine/Manage system/direc-nav in-game-menus Enabled at the beginning of the action list and just before the Acrion Turn on the title menu. In this case the title menu isn't navigable (the "New game" is not selected), but I can't navigate even with mouse or controller.

  • Is this also the case if you temporarily switch the Menu's Source to Adventure Creator?

    Try creating a separate Cutsene that uses the Menu: Select element Action to force the selection of the New Game button. Run it manually via its Inspector when the menu is open - does that select it?

  • Make sure that the Cutscene that turns on the Menu runs in the background.

  • Is this also the case if you temporarily switch the Menu's Source to Adventure Creator?

    If I switch to a Title menu in AC mode it works.

    Make sure that the Cutscene that turns on the Menu runs in the background.

    It's already set to Run in background, but with Unity UI seems not to work, while Ac menu is ok.

  • Try creating a separate Cutsene that uses the Menu: Select element Action to force the selection of the New Game button. Run it manually via its Inspector when the menu is open - does that select it?

    If I add a this action it works and I can navigate (and this is good), but I have the other little issue: the cursor can select another button, so I can have two button selected.

  • I have the other little issue: the cursor can select another button, so I can have two button selected.

    Is this an issue when you return to this menu from e.g. Help?

    I can't reproduce such an issue - to test, I'm using the default Pause menu, set to appear manually, unpaused, with Unity UI.

    Try switching over to Default_MenuManager and make the same changes. Is it then able to work? If so, it may be some aspect of your own Menu Manager.

  • Is this an issue when you return to this menu from e.g. Help?

    Both when I start the scene and when I return to this menu from another one (Ex. Help or Load).

    If I check "Pause game when enable" I solve the issue: if I use the controller it could be good not to have the cursor. So if this option don't generate other issues I think I could solve in this way.

  • Hello Chris, I made progress.
    Fot Title Menu I force the select element (Menu/select element) and checked "Pause game when enable". In this way I can see the correct element selected and I haven't the cursor on other button.
    I solved also the issue with the options menu, forcing the selection of the element.
    Very good. So I went on with other menu.

    But I have some minor (I hope) issues:

    Now the little issue is about navigation when I haven't all the slots full. In this case it starts from the first slot and, when I press the up button, it correctly goes to Back Button. But when I press Down button, it "loses" the connection as it tries to navigate on empty slots. So I'd like to can navigate "recognizing" the slots so the behaviour is correct. I have the same problem in inventory: it select the first element, but where there aren't objects (empty slot), it navigate on the empty slots, while I'd like it stops on the last slot where there's an object. Here the Inventory Menu: https://drive.google.com/file/d/1P7KlfaCNUUo4AOeYxZnHaApdJdb2mw6A/view?usp=sharing

    Are there some options to make it work correctly?

    Thank you.

  • Unless you supply a custom EventSystem prefab in the Menu Manager, the cursor's influence on menus should be limited to those that aren't directly-controlled automatically.

    This is the behaviour I'm getting when using the default interface - if you want to resume looking into this, switching over and comparing your two Menu Managers in the way I describe above will need to be the next step.

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.