Forum rules - please read before posting.

Feature Request: Tickbox on Interaction components where one can Lock Menu or disable input

I'm doing some final-ish polish on my game and I am finding a lot of instances where I do not want pressing Esc to bring up the Pause menu. - Camera Fades, while NPCs are speaking, transistions, Animations etc...

I can lock and unlock the menu in the ActionList but it would be more convenient to just tick a box next to Pause Gameplay on the Interaction component.

Possible?

Comments

  • It would be more convenient to just tick a box next to Pause Gameplay on the Interaction component.

    The Pause menu is part of your own, customised interface - there's too much separation between this and the Interaction system to have such a checkbox integrated officially.

    It's all possible with custom events, though:

    using UnityEngine;
    using System.Collections;
    using AC;
    
    public class LockPauseOnInteraction : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnBeginActionList += OnBeginActionList;
            EventManager.OnEndActionList += OnEndActionList;
        }
    
        private void OnDisable ()
        {
            EventManager.OnBeginActionList -= OnBeginActionList;
            EventManager.OnEndActionList -= OnEndActionList;
        }
    
        private void OnBeginActionList (ActionList actionList, ActionListAsset actionListAsset, int startingIndex, bool isSkipping)
        {
            if (actionList == GetComponent<Interaction>()) PlayerMenus.GetMenuWithName ("Pause").isLocked = true;
        }
    
    
        private void OnEndActionList (ActionList actionList, ActionListAsset actionListAsset, bool isSkipping)
        {
            if (actionList == GetComponent<Interaction>()) PlayerMenus.GetMenuWithName ("Pause").isLocked = false;
        }
    
    }
    

    When attached to an Interaction, the Pause menu will be locked while running.

  • Thanks. Thats another good alternative.

    How about instead: a tickbox which locks ALL menus whilst running the interaction? I feel this would be a good accompaniment to the Pause Gameplay tickbox and would be commonly used.

    I see Pause Gameplay and Lock Menus as similar functions, gameplay-wise.

    What do you think?

  • Locking menus would prevent both Subtitles showing, and would also interfere with locking/unlocking states that may occur as part of the Interaction itself.

    Again, though, it can all be done with events.

  • edited February 2020

    I would be awesome, however, to allow turning the "ignore cursor clicks?" option on or off through an action. That way, menus could be kept visible on screen, but still temporarily deactivated.

  • Any menu property - and Manager field - can be altered through script, and often this is more appropriate than an Action since the field you want to alter may be very specific / rarely used by others.

    Right-click on the option's label and you'll get an API reference to it. It'll be something of the form:

    AC.PlayerMenus.GetMenuWithName ("MyMenu").ignoreMouseClicks
    

    If you then create a new C# file, you can place this line in a pair of functions to turn this setting on and off:

    public void AllowClicks ()
    {
        AC.PlayerMenus.GetMenuWithName ("MyMenu").ignoreMouseClicks = false;
    }
    
    public void DisallowClicks ()
    {
        AC.PlayerMenus.GetMenuWithName ("MyMenu").ignoreMouseClicks = true;
    }
    

    Attach this to a GameObject and make it a prefab. You can then run these functions from within an ActionList by using the Object: Call event Action to trigger these functions from the prefab.

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.