Forum rules - please read before posting.

Unity UI-based menus and double-clicking issue

Hello. Sorry for my english.

I have a Unity UI-based menu with a button that has a Action List attached to it that trigger subtitles (the subtitles menu is AC-based). When I click on the mouse button, of course, subtitles appear. And to skip the subtitles, I need to press the button again. I have a problem. If I do not move the cursor from the button, then at the same time as the subtitles are skipped, a second click on the button will also occur. When I use both AC-based menus (for button and subtitles), there is no such problem.

I would be extremely grateful for your help.
Thanks.

Comments

  • As far as I understand, this is due to the fact that a Unity UI-based menu with a button is processed earlier than a menu with text. I tried to change the position of these menus relative to each other in the AC game editor, but the problem remains.

  • AC processes the default speech-skipping mouse click when the button is pressed down, whereas Unity UI processes default clicks when the button is released.

    It's probably a case of making these consistent. To have a Unity UI Button respond to down-clicks, set its Responds to field in the Menu Manager to Pointer Down, rather than Pointer Click.

    Alternatively, to have speech be skipped when the mouse button is released, uncheck the Speech Manager's Can skip with mouse clicks? option, and use a custom script to override the input:

    using UnityEngine;
    using AC;
    
    public class SkipSpeechClickUp : MonoBehaviour
    {
    
        private void Start ()
        {
            KickStarter.playerInput.InputGetButtonDownDelegate = CustomInputGetButtonDown;
        }
    
        private bool CustomInputGetButtonDown (string axisName)
        {
            if (axisName == "SkipSpeech")
            {
                return Input.GetMouseButtonUp (0);
            }
            return Input.GetButton (axisName);
        }
    
    }
    
  • Thanks for the explanations.
    The question of menu sorting remains open to me, because if all the menus are AC-based, I can easily change their positions relative to each other in the AC game editor. Is it possible to sort Unity UI-based in the same way if they are mixed with AC-based? Or should I have all menus be Unity UI-based and just use different Sort Order values for different Canvases.

    Thanks.

  • Unity UI and AC menus use different rendering techniques - it's not possible to control the sorting order between the two types.

    AC menus will always be drawn on top of Unity UI menus, and it's best to have all menus rely on the same rendering mode.

    Generally speaking, I recommend using AC menus for rapid-prototyping, and Unity UI for final design.

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.