Forum rules - please read before posting.

Strange issue with menu button

I have a letter as an inventory object that can be clicked on, showing a close-up version that I have a menu for.

The first time the character picks up the letter, it automatically shows the close-up. It's then put in the inventory window.

The menu is a Unity UI prefab, and it only has a background texture, a text box and a button for closing the menu.

I link the button from the AC menu manager to the button in question in the prefab. I make sure "select first visible element" is checked. In the AC menu manager, I create an action list for when the button is clicked (it should simply turn off the menu).

The mystery is that when this happens in the first instance, pressing space (which is how interactions are handled in my game) will indeed work, but when I turn on the menu from the inventory window, it suddenly won't answer to any key-presses. I use the same action for turning on the menu in both instances. The only difference is that when I click the inventory item, I also turn off the menu that holds the inventory window, since that will cover the Unity UI otherwise.

I have tried equipping the letter on start to be able to test if the order has some significance, but to no avail. When the menu is turned on via the inventory object click, the button won't work.

I have tried substituting "first visible element" to the specific button element. I'm assuming I should use the name of the element in the AC manager, and not from the Unity UI prefab? It's not working, though.

Am I correct in letting the AC menu manager handle the button click, or should this be handled in the Unity UI itself? I noticed there's an On Click in the inspector window for the button.

However if I disable direct-control of the menu and use the mouse instead, the button does work as intended.

If you don't have some kind of immediate idea I'll post some screenshots.

Comments

  • Ok, I fixed this myself.
    I put an additional Menu:Select Element when turning on the menu.
    No idea why it's not enough to use the check box that already is in the inspector, but now it works!

  • I can't say for sure without seeing it for myself, but it may be related to the relative ordering in the Menu Manager's Menu stack.

    If two directly-controllable Menus are open at the same time, the one below the other in the stack will be given priority when it comes to automatically selecting an element.

    In this case, the use of the Menu: Select Action is the correct way to manually force the selection.

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.