Only one Button on Menu Doesn't Play Action List

Announcements, support questions, and discussion for the Dialogue System.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Only one Button on Menu Doesn't Play Action List

Post by CodePrincess »

Something about this is so familiar, but I can't find a post on it. Sorry. :oops:

So I have a save menu with 3 save slots and 1 "Back" button. The back button registers as clicked on the Event System, The save slots run fine, the menu is not set to "Pause game when enabled", and the Action List attached is set to "Run in Background", so nothing should be paused.

I thought maybe there was an error in the logic in the Action List itself, so I opened with a comment. Even though there were no conditions or commands in before the comment, it doesn't show up in the console. Finally, I tried deactivating anything from other objects that might have covered the button, but nothing seemed to change, which kind of makes sense since the Event System did register the click, now that I think of it.

What else should I look for? I'm excited to hear any suggestions anybody might have.

Take care!
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by Tony Li »

Hi,

In AC's Game Editor > Menus panel, is the Back button assigned to that menu?
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by CodePrincess »

I just double-checked, and it can confirm that it is.
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by Tony Li »

Is the action list connected to the Back button?

If you're using a prefab, is it possible that the Constant ID changed?
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by CodePrincess »

The action list is connected to the Back button.

True, it's called the "Exit" button, but the graphic the button uses says "Back", so I kind of call it that most of the time.
Sorry for the confusion :oops:
https://www.mediafire.com/view/dm37bl19 ... u.png/file

I am using a prefab, but the constants look pretty consistent:
https://www.mediafire.com/view/06x210h7 ... n.png/file

You'll notice that the Linked Button field is marked as "Exit" (Button). Normally, this would say, "None", and the only way you could tell that the Linked Button field was initialized at all is by the "Recorded ConstantID text displayed below. The reason it's there now is that I had just tried to reassign the Exit Button to that field to see if the ConstantID would change. It didn't, unfortunately.

What do you think I should try next?
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by Tony Li »

As a test, try assigning a Hover sound and/or tick Change cursor when over? and specify a cursor.

Then play and see if the hover sound and/or cursor change occurs when you hover the mouse over the button.

Feel free to send me a reproduction project if you'd like to. I'm wrapping up work for the night, but I can check it first thing in the morning.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by CodePrincess »

As a test, try assigning a Hover sound and/or tick Change cursor when over? and specify a cursor.

Then play and see if the hover sound and/or cursor change occurs when you hover the mouse over the button.
I did as you said, and even applied the cursor changes to the Scene Menu. Scene Menu and GameSaveMenu both use prefabs, but Scene Menu's cursor changes worked, but the save menu's didn't.

It's also a little strange that the hover sounds don't seem to work on any of the menus I've tried. The settings tab doesn't seem to say they've been muted or anything.

I've sent off the project like you suggested. Thank you for your help Tony!

PS: I think I owe you an apology: I get so used to coming to you like my own personal programming guardian angel that I didn't stop to ask myself whether or not this bug had any connection to Dialogue System for Unity at all. It was all Adventure Creator, wasn't it? Sorry! :oops:
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by Tony Li »

No worries! I imported the package into an older copy of your project that I had on hand -- and the Exit button works! So it looks like your AC Menu Manager and your SaveMenu UI prefab are both OK.

Let's figure out why you can't click it in your current project. While playing, keep an Inspector on the EventSystem GameObject. If you hover the mouse over the Exit button, the pointerEnter line should be "Exit". If you click-and-hold on the button, the Selected line should be "Exit", and when you release the mouse button it should click it.
acEventSystem.png
acEventSystem.png (7.25 KiB) Viewed 1039 times

Maybe some other (transparent?) UI element is blocking the Exit button.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by CodePrincess »

Here's what Event System told me:

When I hover over the Exit button:
https://www.mediafire.com/view/ysrfxxj6 ... n.png/file

When I click the Exit button:
https://www.mediafire.com/view/3shmhvuj ... n.png/file

If I read it correctly, It seems to believe I did click the Exit button.
This isn't completely related, but I noticed I couldn't get the buttons of any menu to play hover sounds, either.

Could Unity 2020.1.10f have anything to do with this? Should I use a newer or older version?
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Only one Button on Menu Doesn't Play Action List

Post by Tony Li »

I think I see what's happening, and -- if so -- it is related to the Dialogue System. Notice that the top line is:

Selected: Continue Button

If the Dialogue Manager's Input Device Manager > Input Mode is set to Joystick or Keyboard, or if Always Auto Focus is ticked, then the Dialogue System will steal UI focus when conversations are active. If a conversation is active and showing a subtitle, then it will keep putting input focus back on the continue button -- even if you're trying to show a different menu on top of the conversation.

One solution is to tell the Dialogue System to not steal focus while the menu is active. To do that, add this script to the menu prefabs:

StopAutoFocusWhileActive.cs

Code: Select all

using UnityEngine;
public class StopAutoFocusWhileActive : MonoBehaviour
{
    protected static int numMenusEnabled = 0;
    
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
    static void Init() { numMenusEnabled = 0; }
    
    void OnEnable() 
    { 
        numMenusEnabled++;
        PixelCrushers.UIPanel.monitorSelection = false; 
    }
    void OnDisable() 
    { 
        numMenusEnabled--;
        if (numMenusEnabled == 0) PixelCrushers.UIPanel.monitorSelection = true;
    }
}
If this part throws an error in your Unity version, you can remove it:

Code: Select all

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void Init() { numMenusEnabled = 0; }
Post Reply