The virtual cursor beta is ending soon, thank you to everyone who tried it and gave feedback! The next step for virtual cursor is a developer setting to opt in or out of the feature in their experiences. Initially it will be just opt in but will move to being enabled for all once developers have had time to incorporate virtual cursor. We know some games won’t work well with virtual cursor and we will work directly with those developers to resolve their issues and concerns. More details coming soon!
User Interface (UI) designed and implemented for most Roblox games are generally built for mouse and touchscreen input. Working on custom gamepad controls for the UI might not always be a priority over working on your game mechanics and content.
We wanted to provide a solution that works for all types of UI layouts automatically. This led us to build a mouse-like cursor that provides easier UI navigation across all Roblox games. What’s amazing, is this also unlocks gamepad UI support for games that are menu-heavy, that did not previously work with gamepads at all!
What Is the Gamepad Virtual Cursor?
We are excited to bring you the Gamepad Virtual Cursor, which is a mouse-emulation cursor for gamepad input, for interaction with game UI that were not necessarily designed or customized for gamepad.
How It Works:
The Gamepad Virtual Cursor will work in any Roblox place, unless custom gamepad navigation controls have been set up. Use the left thumbstick to move the cursor around the screen to highlight UI buttons/menus. Triggering the UI button is the same as before - simply press the A Button to trigger or interact with the highlighted UI element.
The Virtual Cursor selects the closest GUI button (TextButton or ImageButton) with the highest ZIndex. Virtual Cursor will ignore objects with Selectable set to false or Active set to false. If the cursor is hovering over several UI objects, the object that is closest to the center of the cursor will be highlighted.
You may also notice that the cursor will automatically slow down when it hovers over an interactable UI element. We did this to reduce the chance of a player accidentally scrolling past the UI element. Once the cursor moves off of the UI element it will return to full scrolling speed.
The Virtual Cursor essentially acts like a mouse for certain events. You will be able to listen to MouseEnter, MouseMoved, and MouseLeave events as well as the mouse position using GetMouseLocation for the virtual cursor - just as if the player was using a mouse.
How can I try this in my game?
First, you must enable the feature as a Studio Beta feature.
To enable the beta feature:
- Launch Studio
- Select File, Beta Features .
- Check the box next to “Gamepad Virtual Cursor Beta” and click Save .
- When prompted, restart Studio.
In order to use it in the game, plug in a gamepad controller and run your game in Studio. Press the View button (or the equivalent button) to enter virtual cursor mode, at which point you can move around freely with the left thumbstick. Pressing the View button again will return back to full control of your character.
What if I already have custom gamepad UI support?
If you already set up custom gamepad menus and navigation, you are awesome! We suggest you review the functionality of the virtual cursor and decide whether you want to keep your custom controls or use the new system. After reviewing, if you would like to keep your custom solution, the virtual cursor can be disabled.
Setting AutoSelectGuiEnabled to false for all players will prevent the virtual cursor from running. In order to get UI selection, you will have to manually set the SelectedObject.
For example insert a LocalScript in StarterPlayer/StarterPlayerScripts with this code
-- Only use this if you do not want virtual cursor in your game!
local guiService = game:GetService("GuiService")
guiService.AutoSelectGuiEnabled = false
Common Problems:
If you are trying virtual cursor out in your game and it is not behaving correctly, here are a few things you can check:
If you hover over a GUI button that you expect to be highlighted but it is not, make sure the button property Selectable is set to true.
If you bind the view button (or equivalent button) to start UI mode but do not set AutoSelectGuiEnabled to false, you will get both the virtual cursor and the old UI selection system. Try not setting an initial SelectedObject and let virtual cursor handle the navigation! Or, if you want to keep your current navigation, simply set AutoSelectGuiEnabled to false.
In addition, you will need to disable the virtual cursor if you are using the view button for a custom bound special action or functionality. If you do not set AutoSelectGuiEnabled to false, the virtual cursor will be active.
Feedback:
We are releasing this as a Studio Beta first in order to give you a chance to send feedback and let us know about any problems you see in your game. We encourage you to post feedback and let us know what you think!
Known Issues:
- BillboardGui or SurfaceGui or TextBox interaction is not currently supported
- Clicking and dragging a UI element doesn’t currently work
- Unable to scroll up or down in scrolling frames (we are considering the use of the d-pad for this, when a scrolling frame is highlighted)
-
The mouse cursor does not properly set its position to the virtual cursor center. This will be fixed shortlyThis is now fixed