Forum rules - please read before posting.

Locking Cursor (mouse clicks) for Unity Based UI Menus

Hello.
Sry for my english.

Can I lock the cursor when working with Unity Based UI menu? When I work with the AC-based menu, there are no problems - I lock the cursor using Actionlist > Manage System. But when I switch to Unity Based UI Menu it doesn't work anymore.

Can I use standard AC tools to make the cursor lock for a while when opening the Unity UI Based Menu (to avoid missclicks).

Right now I'm using Animator, which removes the panel that blocks the rays. But I don't really like this implementation.

Thx alot.

Comments

  • In what way does it not work? Does the cursor still move, or are the UI Buttons responding somehow to the locked cursor?

    If you're locking the cursor, is that because you're looking to have menus be interactive through direct (e.g. keyboard) control? See the Manual's "Navigating menus directly" chapter for details on this topic.

  • In what way does it not work? Does the cursor still move, or are the UI Buttons responding somehow to the locked cursor?

    Unity Based UI buttons are highlighted and respond to clicks even when the cursor is hidden. When I use the AC-Based menu, there is no such problem.

    If you're locking the cursor, is that because you're looking to have menus be interactive through direct (e.g. keyboard) control? See the Manual's "Navigating menus directly" chapter for details on this topic.

    I just want to block mouse clicks for a second when the conversation menu appears to avoid erroneous clicks and erroneous menu item selection. This has nothing to do with switching to keyboard control.

    Thanks for the quick response.

  • Unity Based UI buttons are highlighted and respond to clicks even when the cursor is hidden.

    Locking and hiding the cursor are separate - is the cursor still moving while its locked, and what is your "Cursor rendering" option set to in the Cursor Manager?

    I just want to block mouse clicks for a second when the conversation menu appears

    Is this due to the Menu having a non-instant Transition? A brute-force approach would be to attach a Canvas Group to the root Canvas, and control its Interactable property during the transition - either through animation or by hooking into the OnMenuTurnOn custom event.

  • Locking and hiding the cursor are separate - is the cursor still moving while its locked, and what is your "Cursor rendering" option set to in the Cursor Manager?

    https://disk.yandex.ru/i/XcIsfsXEOvhQmg
    https://disk.yandex.ru/i/Xrl-yYaBZyifXQ

    In this state, I can move the cursor (which is not visible) and all Unity UI-based menus react to this invisible cursor. At the same time, all AC-based menus do not respond to it. I think I've tried all the global cursor settings options.

    Is this due to the Menu having a non-instant Transition? A brute-force approach would be to attach a Canvas Group to the root Canvas, and control its Interactable property during the transition - either through animation or by hooking into the OnMenuTurnOn custom event.

    Thanks alot. The custom animation transition type solves the current problem, but I still can't figure out if there is an option to make unity ui based menus stop responding to the cursor. I'm sure I'll need this in the future.

  • Don't disable the Input system - that will keep the software cursor in place while its locked.

    The system cursor will continue to display, as "Always show system cursor in Editor?" is showing.

    Does the issue occur in builds, and are you relying on a custom EventSystem / is an EventSystem object present in the scene file? Check the Console - a message should be displayed regarding this if this is the case.

    If so, remove it to allow AC's own EventSystem to spawn - which should force the software cursor's position to be used by UI components, rather than that of the system cursor.

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.