Disabling character input when opening a menu

frothy

New member
Hey there, I've searched around and found some simliar questions but can't seem to get them working for me.

I'm trying to use the interact ability to trigger a menu but once it's open, I can't click on the UI. Here's what I'm doing.

Code:
public class TerminalInteractable : StateBehavior, IInteractableTarget, IInteractableMessage
{

    public void Interact(GameObject character) {
            
            OpenMenu();
            
            EventHandler.ExecuteEvent(character, "OnEnableGameplayInput", false);
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible = true;

    }

}

The menu pops up, the cursor is released, the character/camera stop moving but I can't click anything in the UI or interact with anything in anyway.

Does triggering the OnEnableGameplayInput event disable user input of all kinds?

Thanks!
 
Does triggering the OnEnableGameplayInput event disable user input of all kinds?
No, it is local to the character controller.

My guess is that this is something related to your UI capturing raycasts. OnEnableGameplayInput won't affect your UI.
 
No, it is local to the character controller.

My guess is that this is something related to your UI capturing raycasts. OnEnableGameplayInput won't affect your UI.

DOH. Thank you! For some reason there was no Graphics Raycaster on this specific canvas.

Hopefully an equally silly miss, is there something specific I need to do to in order to properly inherit the IInteractableMessage class? This isn't showing any message text in the UI and the only way I can is if I populate the field on the ability itself on the character in the inspector.

Code:
    public string AbilityMessageOverride = "Press F to open terminal";

    public string AbilityMessage()
    {
        return AbilityMessageOverride;
    }
 
DOH. Thank you! For some reason there was no Graphics Raycaster on this specific canvas.

Hopefully an equally silly miss, is there something specific I need to do to in order to properly inherit the IInteractableMessage class? This isn't showing any message text in the UI and the only way I can is if I populate the field on the ability itself on the character in the inspector.

Code:
    public string AbilityMessageOverride = "Press F to open terminal";

    public string AbilityMessage()
    {
        return AbilityMessageOverride;
    }
For anyone who finds this in the future, I was able to get it working by adding {0} by itself to the UI > Ability Message field on the Ultimate Character Locomotion script under the Interact abilities UI > Ability Message.

Make sure you're in the section for the ability and not the item ability section, there's no visual differentiation other than the section they're in.

The docs mentioned requiring {0} but I thought that was in your interface script, not the character. I guess the locomotion script needs to know where to put your ability interfaces message. So if you want just your message specified in the ability interface, just put the {0} like this.

ability-message.jpg

✅ resolved
 
Top