Forum rules - please read before posting.

Triggering Save list _OnClick ActionList through keyboard/controller input

Unity: 2018.4.1f1 AC: 1.71.8

Hey, I'm in the final stages of having my save UI system working. It's currently fully functional using mouse input but I've run into a hurdle when it comes to keyboard input for the save list itself. (The game will support full keyboard/controller only input as well as mouse+keyboard)

I'm looking to run the actionlist SaveScreenshots_List1_OnClick through keyboard input (no mouse), I have the input setup using active inputs and on the keypress having it run the above actionlist. There aren't any issues with the input itself.

The problem comes with the actionlist parameter value which is used to keep track of the list's slot index. It doesn't seem to be assigned the Save ID # if the actionlist is run through any means apart from clicking the list physically with the mouse.

I've tested by simply clicking the blue Run button in the actionlist editor with this list open (to rule out any active input issues) and I seems its trying to save to the default parameter value (0). At least, that's the only thing I can thing of causing this issue. It all works fine when clicking with the mouse.

The actionlist in question:

The menu setup showing the parameter:

The list only displays one slot, I use ShiftNext and ShiftPrevious buttons to offset this slot to navigate between the 10 save files (11 including an autosave).

Is it possible to force this parameter to update with the Save ID # through a custom action? I'm not sure how else to approach this issue.

Any help would be appreciated.

Comments

  • The ID is only set automatically when the asset is run by interacting with the Menu - as this is how AC can determine which slot you're clicking on.

    Are you not looking to navigate the menu directly? If you enable direct-navigation at the top of the Menu Manager, and configure a first-element-to-select in the Menu's properties, you can navigate the menu with a controller instead of a mouse, and interact with elements by pressing the InteractionA input.

    If you rely on an Active Input to run the asset - or run it via its Inspector - you'll have to use a custom script to hook into the OnBeginActionList event and assign the parameter value manually.

    Something like:

    using UnityEngine;
    using AC;
    
    public class SetSaveSlotParameter : MonoBehaviour
    {
    
        [SerializeField] private ActionListAsset actionListAsset;
    
        private void OnEnable () { EventManager.OnBeginActionList += OnBeginActionList; }
        private void OnDisable () { EventManager.OnBeginActionList -= OnBeginActionList; }
    
        private void OnBeginActionList (ActionList actionList, ActionListAsset actionListAsset, int startingIndex, bool isSkipping)
        {
            if (this.actionListAsset == actionListAsset)
            {
                MenuSavesList savesList = PlayerMenus.GetElementWithName ("SaveScreenshots", "List1") as MenuSavesList;
                int offset = savesList.GetOffset ();
                int parameterID = 0;
                actionList.GetParameter (0).intValue = offset;
            }
        }
    
    }
    
  • Thanks Chirs, you've completely hit the nail on the head there.

    I am indeed using direct navigation for menus, thing is with this menu I forgot to select an element when it opens. A really amateur mistake that I was overlooking because the navigational elements are all triggered through their alternate input button field, so everything else was working as intended.

    Yet again you prove to be the absolute best on the internet when it comes to support. Thanks mate.

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.