Forum rules - please read before posting.

Show cursor in the menus only

Hi,

my goal is to show cursor in game menus only, both when game is paused (in-game pause menu) and when game is running (title menu when game is started). I don't want to show cursor in regular gameplay.

But I can achieve only to show cursor allways or never:-)

Here is my settings:

When I switch settings to DISPLAY CURSOR: ONLY WHEN PAUSED, only system cursor will show allways (both in menus and in regular gameplay).

When I have DISPLAY CURSOR: ALWAYS and in the scene I set ENGINE: MANAGE SYSTEMS: CURSOR: DISABLED, it doesn't work, cursor is still visible.

Please, what am I doing wrong?

Thanks,
Jakub

Comments

  • edited March 23

    Disabling the Cursor system with the Engine: Manage systems Action doesn't hide the cursor - it prevents AC from affecting it at all.

    If you use Software rendering - which AC manually draws each frame - this will be enough. For Hardware rendering, however, you'll need to then rely on a custom script to manually hide the cursor once you've run this Action:

    using AC;
    using UnityEngine;
    
    public class SetCursorVisibility : MonoBehaviour
    {
    
        public void HideCursor ()
        {
            Cursor.visible = false;
        }
    
    }
    

    To run from an ActionList, attach to a GameObject, make a prefab, and use the Object: Call event Action to reference the prefab's HideCursor function.

    For this to work while testing in the Editor, you'll need to uncheck Always show system cursor in Editor?. Otherwise, you'll need to limit testing of this to builds.

  • It works!

    Thank you very much!

    Have a nice day!

  • Actually it's not working:-(

    Cursor is visible in regular gameplay. In cutscenes it dissapear.
    I tried to switch to Software cursor rendering, but in this case cursor is not visible at all. Even if try Engine: Manage systems with Software rendering, cursor is not visible.

    Is the script you sent me really correct please?

    Or can I provide you some other screenshots to help resolve my cursor sadness?
    I tried many combinations of different settings but I ended up with two results only: cursor is visible all the time except cutscenes or cursor is not visible at all.

    Jakub

  • How is your game played?

    Your Input method is set to Keyboard Or Controller - i.e. no mouse - so any cursor you use will be simuated.

    Because of this, set Cursor rendering to Software. If the cursor doesn't show, try altering the texture asset's type to Default.

    No script should be necessary with this - nor should an Engine: Manage systems Action to disable the Cursor system.

    Instead, check Lock cursor in screen's centre when game begins? and Hide cursor when locked in screen's centre?, both in the Settings Manager's Interface panel.

    To unlock the cursor during gameplay, you can then use the Player: Constrain Action.

  • I checked Lock cursor in screen's centre when game begins? and Hide cursor when locked in screen's centre? and switched Cursor rendering to Software.

    Now I can control visibility of the cursor by Player: Constrain (it's progress!) but unfortunately cursor is not moving, it's still locked in screen centre.

    Do you know why cursor doesn't move please?

    Thanks,
    Jakub

  • How is your game played - what input device are you using?

    The simulated cursor is moved using inputs named CursorHorizontal and CursorVertical - have you added these to Unity's Input Manager?

  • My game is played on keyboard only. Mouse is needed for the menu.

    I have added CursorHorizontal and CursorVertical and now the cursor is moving! Thanks!

    I have last little question, cursor is moving differently than the system cursor, speed is not same and menu items reacts to the system cursor only, not to the simulated cursor (in both editor and build).

    Can I somehow sync simulated cursor to the system cursor, or set simulated cursor to be interacting with menu items please?

    Thanks again for your help, Chris.
    Jakub

  • The simulated cursor is separate to the system cursor - its speed is set by the Simulated cursor speed setting, and acceleration by the inputs in the Input Manager.

    From what you describe, though, it doesn't sound like you need it. Set the Input method to Mouse And Keyboard, and the cursor - when unlocked - will have the same position as the system cursor.

  • Now everything works perfectly!

    Thank you, Chris!

    Have a nice day,
    Jakub

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.