Virtual Cursor
Move a UI cursor freely or follow the selected control
Overview
Virtual Cursor provides a Destiny-like visible UI cursor driven by the Input System. It can move freely or follow EventSystem selection, with ring, outline, corner, and custom visuals.
Usage
Add Virtual Cursor under your UI Canvas.
Assign the EventSystem’s InputSystemUIInputModule.
Choose Free or Follow Selection movement.
Choose accepted input devices, movement bounds, and a visual preset.
Add Virtual Cursor Override to targets that need different padding, color, or outline settings.
Customization
- The cursor can fit the target rectangle and inherit Procedural Shape corner radii.
- Configure dash style and animation separately.
- Use custom colors or Styler mappings for normal, target, and pressed states.
Public API
Use VirtualCursor in the Evo.UI namespace.
Properties
| Name | Type | Description |
|---|---|---|
ScreenPosition | Vector2 | Read-only screen position. |
CurrentTarget | GameObject | Current target GameObject. |
IsPressed | bool | Read-only pressed state. |
Fields
| Name | Type | Description |
|---|---|---|
inputModule | InputSystemUIInputModule | Input System UI module supplying actions. |
movementMode | MovementMode | Free movement or FollowSelection. |
inputDevices | InputDevices | Accepted device flags. |
movementSpeed | float | Free-movement speed. |
fitToTarget | bool | Fits the visual to the target. |
Methods
| Name | Parameters | Description |
|---|---|---|
SetScreenPosition() | Vector2 position | Moves to a screen position. |
RefreshInput() | None | Requests input rebinding after configuration changes. |
UpdateStyler() | None | Refreshes themed colors. |
Virtual Cursor Override
Per-target overrides can replace color, corner radius, target padding, outline width, center size, and edge softness. Enable each override explicitly; unset overrides continue using the cursor’s configuration.
Example
using UnityEngine;
using Evo.UI;
public class VirtualCursorExample : MonoBehaviour
{
[SerializeField] private VirtualCursor target;
private void Start()
{
target.movementMode = VirtualCursor.MovementMode.FollowSelection;
target.fitToTarget = true;
target.targetPadding = new Vector2(12f, 12f);
target.RefreshInput();
}
}