Forum rules - please read before posting.

Menu elements that respond to being "Selected" / Highlighted

I'm trying to figure out a way to make menu elements in my game that respond when they are selected/ highlighted (while the player is in direct-navigation)

AC's menu system allows your buttons to respond in 3 different ways...

Responds to:
1. Pointer Click
2. Pointer Down
3. & Pointer Enter

"Pointer Enter" works as intended when you're using a cursor, but I fail to see a way to make use of this option if the player is directly navigating menus. (since the cursor isn't available to enter the menu element's space)

I'm not sure if AC already has an action that does this somewhere, or if I need to create a custom action but any help would be nice!

Comments

  • I might as well share exactly what I'm trying to create, so there's a better idea of the problem I'm trying to solve.

    When the player enters this menu it switches them into "direct-navigation", allowing them to highlight each space on the screen with the WASD keys.

    With the basic settings, each button is set to "Respond To: Pointer Click", allowing the player to press an input to activate each button, but that's not exactly what I want.
    Instead, I need each button to respond immediately when the player moves to/ highlights said button, forcing them to activate each button they navigate to. The player shouldn't have the ability to activate the buttons by their own input, they must activate each button they pass over.

    I have been attempting a few different methods to create this effect but failed, unless there's an easy way to tell each button to activate when they're highlighted through AC then I might scrap this idea for something else.

    I appreciate any advice, and thank you for your time!

  • If you're ultimately just running an ActionList when the Button it interacted with, it's probably easiest to just bypass the Menu Manager completely - either by removing the Button elements, or just setting their Click type properties to Custom Script to stop anything happening when clicked.

    With the click behaviour gone, you can then attach this script to a given UI Button object to have it run an ActionList when selected by the Event System:

    using UnityEngine;
    using UnityEngine.EventSystems;
    using AC;
    
    [RequireComponent (typeof (ActionListStarter))]
    public class ActionListOnSelect : MonoBehaviour, ISelectHandler
    {
    
        public void OnSelect(BaseEventData eventData)
        {
            GetComponent<ActionListStarter> ().RunActionList ();
        }
    
    }
    

    Adding this will also attach an ActionList Starter component, which you can use to specify an ActionList asset to run. If that asset uses parameters, you'll be able to set their values in the Inspector.

  • Okay that seems to work great! I don't think I have any other problems with the way it's working now. Thankyou for taking the time to help! You're always extremely helpful whenever I have new questions Chris. AC has been a lifesaver, and I can't stress enough how much I appreciate your work!

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.