Forum rules - please read before posting.

Hide menu button when dialogue option disabled

I've been making good progress building my XP-based conversation wheel menu using a Unity UI canvas. But now I've encountered a problem. So I have an XP-check action list running before each conversation to enable or disable options and that's working great.

But now that I've started to fill out the UI canvas to the second level of the wheel (where the XP check disables options), it's disabling the option just fine, but the UI button remains on screen.

https://imgur.com/a/uULVRGR

So in that picture, the "optimistic" option is disabled. I can select all the others (as I want), the optimistic button is non-responsive (as I also want). But, I don't want the "optimistic" button to show up on screen when the option is disabled. I feel like I'm missing something simple to fix this lol.

Comments

  • You can configure the appearance of a disabled Button in Unity's Button component Inspector. If the "Transition" is set to "Color Swap", a Disabled color with zero alpha will have it be invisible at this time.

  • Hmm, I must be doing something else wrong then lol.

    I have the conversation menu referencing Unity UI Prefab, linked to a canvas that (right now) has 8 buttons so I can test that first one that should be going invisible. The 8th conversation dialogue option is "optimistic." I'm using the Dialogue: Toggle action to turn the choices on and off. I've tested that it's referencing the "optimistic" button properly by toggling it on and adding a test subtitle and it does work.

    But when toggled off, the button still shows up even though I have the Disabled color with zero alpha

    A weird thing I've noticed, is that when toggled off, the button will briefly flash invisible when clicked, and then the whole canvas closes. I tested this by trying a Sprite Swap transition and setting the disabled sprite to a different png. Again, when I click "optimistic," it briefly flashes to that other png before turning the whole canvas off.

    So, it's recognizing that that's the right button I want, and it's recognizing that it's disabled, it just seems to behave strangely with that transition setting instead of just setting the whole button to become invisible when disabled.

    My other thought was maybe teleporting the button object off-screen when disabled, but it won't let me do that if I'm using a canvas prefab, only if I'm using an in-scene canvas. Which works, but will become very messy I think once the game starts getting bigger.

  • If the Button is linked to the Menu Manager via a DialogList element, it's display should be automatic.

    It should become disabled automaically provided the When invisible property in the Menu Manager is set to Disable Object, which is the default value.

    AC connects UI Buttons to the Menu Manager by referencing Constant ID values - do all the options have unique IDs, and does the Optimistic Button's ID match that listed in the Menu Manager?

    So as to rule out this being a Unity UI issue, temporarily switch the menu's Source to Adventure Creator (you may have to play with the styling options while previewing in the Game window to have things be visible). Does the option remain hidden when using that method?

  • Sweet! Okay, I think I have it figured. The problem was that I had done some edits in my Conversation asset which resulted in option 8 somehow being listed at the bottom of the dialogue list and "Optimistic" was actually labeled number 9.

    I don't know how to change the number assignments to conversation options, so I guess I'll just re-make the conversation asset such that everything's in the right order and it should work I think.

    Thanks!!!

  • Okay, scratch that good feeling lol... I got them to properly disappear, but now they're enabling (re-appearing) in chronological list order instead of corresponding to the linked button they're supposed to.

    For example, the "optimistic" button is Linked Button (8) in the dialogue list. The "excited" button is Linked Button (17).

    If I use the Dialogue Toggle action to toggle "excited" on, then instead of re-appearing the "excited" button, it re-appears the "optimistic" button.

    If I toggle multiple other buttons on (regardless of the order), lets say three of them, then it re-appears the Linked Buttons 8, 9, and 10, instead of the buttons linked to say 14, 17, and 20 like I toggled.

  • A DialogList element's options aren't mapped to the Conversation options 1:1 - they're mapped to those that are visible.

    For example, the first three options/slots in a Menu will always be linked to the active Conversation's first three available options. So if a Conversation's first option is disabled, the first three slots that show will be the second, third and fourth.

    I don't have screenshots of your setup to confirm this, but I suspect this is the issue here.

    Does this sound about right? It should be possible to create a workaround, but I'll need to know if this is the right direction, first.

  • Ok, I thought that might be the case, makes sense. Yeah, that looks like what's happening.

    I've figured a workaround where I just enable all the options but keep them off screen. Then I can teleport them in place with a marker when they're supposed to be available instead of emailing them.

    Do you think that will work? Or could it cause other complications?
  • It should work, though a bit of a hassle.

    Instead, I shall look into providing an additional property to the DialogList menu elment, that will let you choose between mapping an element to a option by index number, or by the option's ID number. With the latter, you should then be able to have a consistent connection between an element, and a given dialogue option.

    It should be possible to include this in the upcoming v1.73.4 release.

  • That would be amazing, thanks!!
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.