Forum rules - please read before posting.

Ui button stopped working

I have a few canvases I'm using to make an interactive fiction and they're structured like this

Canvas - Text - "Next" button
Canvas - Text - "Next" button

I change between each canvas by hooking up an actionlist to the next buttons. The actionlist just have 2 actions that turn on and off the canvases. My issue here is when I wanted to add something more to the actionlist.

After the turn object turn on action I added a dialogue play speech action and a variable set action. I changed the subtitle menu that ac comes with to something that only plays when narration happens and doesn't ignore input but for some reason, the next button on the current canvas that got switched to isn't interactive at all. I removed the event manager in the heirarchy and still no luck

So

Regular action list:
Object turn off - Canvas 1
Object turn on - Canvas 2

The "next" button on canvas 2 is interactive

New actionlist:
Object turn off: Canvas 2
Object turn on: Canvas 3
Dialogue play speech: You found a key
Variable set: Keys found: increase by value: 1

The "next" button on canvas 3 is not interactive.

Comments

  • edited September 2023

    What are your AC/Unity versions?

    By "Object turn off" - are you referring to a custom Action, or "Menu: Change state"? I'm not clear if the Canvases you're using are linked to AC's Menu system or not.

    Keep AC's Status box open by enabling it at the bottom of the Settings Manager - what does it display when the issue occurs?

    If the Canvas is a Menu, where is it listed in the Menu Manager relative to the Subtitle menu that displays the narration, and what are its properties? Screenshots of the Status box and the Menu's properties would be best, if possible.

  • Sorry by "Object turn off" I meant the "Object: Send message" action which I then use the "turn on" or "turn off" functions of it.

    The canvases I'm using are not linked to AC's Menu. They're just regular canvases in the scene.

    The AC status box goes from "current game state: normal" to:

    Current game state: Cutscene
    Actionlist assets running:
    Change4a
    Gameplay is blocked

    and then back to normal when the actionlist finishes running.

    My AC version is 1.78.4
    Unity version 2021.3.27f1
  • Thanks for the details.

    To be clear: is the Button completely non-responsive, or does it change colour when selected, only clicking has no effect?

    Do you have a script attached to the Canvas? Passing the "Turn On" / "Turn Off" messages to a Canvas directly won't affect it without a component to receive them.

    The game is in Cutscene mode due to the "Change4a" ActionList running. Normally, this would prevent UI Buttons from being interactive (unless Clickable in cutscenes? is checked), but if you're not linking the Canvas to AC then they're interactability shouldn't be affected without custom scripting.

    If you select view the Button's Inspector at the time the issue occurs, what is the state of its Interactability checkbox, or that of any Canvas Group component in the Canvas's Hierarchy?

  • edited September 2023
    The button is completely unresponsive. I have a highlight color set for the button and the color doesn't even change when I hover over it.

    I have a script on the canvas and it's the "Remember canvas group" script you gave me a day or 2 ago.

    In the inspector, the interactability check box of the canvas the button is in becomes checked when the issue happens like the other canvases that ran before it
  • What is the state of the Canvas Group's "Interactable" field at this time, and is there a difference if you set the Change4a ActionList's When running property to Run In Background?

    If there's no difference, try manually disabling the entire Canvas 1 GameObject at the time the issue occurs - is Canvas 2 then interactive?

  • The canvas group's interactable field is checked when the canvas gets turned on but the button isn't interactive. Nothing changes when I set Change4a's actionlist when running property to run in background.

    I manually disabled all the previous canvases that came before the one with the issue and nothing changed
  • I made a new actionlist without the "dialogue play speech" and "variable set" actions to see if that would work for a bit but then stopped working after I put the one with those actions in.

    It's a bit complicated to explain but basically I made a fresh new actionlist without what I thought would cause the issue and the next button worked fine with that actionlist. Afterwards I switched the actionlist out with the one I was using before and that still didn't work. So I tried putting the new actionlist I made that worked before back in and all of a sudden it stopped working after the switch
  • So, the fresh new ActionList was working, and later not working, without making any changes to it?

    Sorry, but I need to be clear: the Button also has an Interactable checkbox - this is also checked, as is that on the Canvas Group?

    If both are checked, then the Button ought to be clickable - unless another UI is overlapping it and being detected instead.

    You can see what element is currently selected from the bottom of the EventSystem's Inspector. If there isn't one in the scene file, AC will generate this object automatically at runtime. What's being shown as selected at the time?

  • Yes, the button's interactable check box is checked as is the one of the canvas group it's in.

    If I go to the Eventsytem's inspector the part that says "Selected:" is empty. Theres nothing after the "Selected:"
  • Very odd.

    Does the interactivity return once the ActionList ends? Are you relying on Input System, or Input Manager (the default)?

    How many such Canvases do you have in the scene? Try disabling all except just Canvas 2, and also keep any AC Menus out of the way as well.

  • The interactivity doesn't come back when the actionlist ends. I'm using Input Manager.

    I have 8 canvases in the scene and a "sidebar" AC menu that runs on start. When I disabled every other canvas but the one I'm having issues with and made my sidebar menu locked on start, the canvas with the issue became interactive.

    Then I enabled the one before it (the one that has the button with actionlist to turn it on) and when I switched between them, the canvas with the issue became not interactable again.
  • Putting the others aside, then, let's call the Canvas with the issue Canvas B, and the one that precedes it Canvas A.

    In short: Canvas B is only interactive if Canvas A's GameObject is disabled outright, but when enabled Canvas A should be "turned off" via the custom script?

    Check that Canvas A's Canvas Group has its Interactability unchecked, but I suspect it already is.

    I can't rule out this being an issue with Unity UI itself, as AC won't be affecting the Canvas's state directly (at least, not without the aid of the custom script). Are your Buttons intended to be selected with the mouse, or are you navigating them directly (i.e. with keyboard/controller inputs)?

    Try inserting the following into the script's TurnOff function:

    GameObject.FindObjectOfType <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject (null);
    
  • The buttons are selected by mouse, yes..

    I added the code into the script's TurnOff function but nothing happened? Although I'm not sure what is supposed to happen with that but nothing changed really
  • So I made a new project to see if the issue would persist on that one or if it was an issue with just that project.

    The problem is a bit worse on the new project. Now just adding a simple actionlist with the "Object:send message" action to turn on and off the canvas makes the canvas completely not interactive.

    I have 2 scenes. In the first one, the canvas there is interactive, the button highlights when I hover over it and everything. The other scene has the exact same canvas, duplicated 3 times for testing, but the only difference is that it has a canvas group, the remember canvas group script and an actionlist attached to it's button but it's completely not interactive. All the duplicates are like this as well
  • The problem is a bit worse on the new project. Now just adding a simple actionlist with the "Object:send message" action to turn on and off the canvas makes the canvas completely not interactive.

    The Canvas has the Remember Canvas Group attached?

    The other scene has the exact same canvas, duplicated 3 times for testing, but the only difference is that it has a canvas group, the remember canvas group script and an actionlist attached to it's button but it's completely not interactive.

    Do they duplicates all overlap, such that the "top" one will block interactivity to those underneath?

    If you have a scene that has nothing but these Canvases, move the scene file to a new folder and place the Remember Canvas Group and ActionList (if asset file) into it. Then PM me the folder as a zip file - I'll see what it looks like on my end.

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.