Forum rules - please read before posting.

is it possible to run an actionlist when an button in the menu is highlighted?

Hi chris,

I see the AC menu enable user to run an actionlist when click on menu button, is it possible to run an actionlist when the cursor is over the menu button (i.e. the button is being highlighted), thanks a lot.

Comments

  • It is - through use of the OnMouseOverMenu custom event:

    using UnityEngine;
    using AC;
    
    public class ActionListOnMouseOver : MonoBehaviour
    {
    
        public ActionListAsset actionList;
        public string menuName, elementName;
    
        void OnEnable () { EventManager.OnMouseOverMenu += OnMouseOverMenu; }
        void OnDisable () { EventManager.OnMouseOverMenu -= OnMouseOverMenu; }
    
        void OnMouseOverMenu (Menu _menu, MenuElement _element, int _slot)
        {
            if (_menu.title == menuName && _element.title == elementName)
                actionList.Interact ();
        }
    
    }
    

    Place this in the scene and fill in the details of the ActionList and menu/element names in its Inspector. If your Menu uses Unity UI, you can instead attach to the UI Prefab itself.

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.