Logo
Navigation

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

NameTypeDescription
ScreenPositionVector2Read-only screen position.
CurrentTargetGameObjectCurrent target GameObject.
IsPressedboolRead-only pressed state.

Fields

NameTypeDescription
inputModuleInputSystemUIInputModuleInput System UI module supplying actions.
movementModeMovementModeFree movement or FollowSelection.
inputDevicesInputDevicesAccepted device flags.
movementSpeedfloatFree-movement speed.
fitToTargetboolFits the visual to the target.

Methods

NameParametersDescription
SetScreenPosition()Vector2 positionMoves to a screen position.
RefreshInput()NoneRequests input rebinding after configuration changes.
UpdateStyler()NoneRefreshes 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

VirtualCursorExample.cs
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();
    }
}

On this page