Home > Game / Unity C# Script > Unity C# Script - Arrow Cursor Renderer
Although you may wish to record the cursor movement with the Unity Recorder in the Play Mode, you may discover that the cursor movement is not recorded.
You can use the script on this webpage to show an arrow when the mouse is pressed. The arrow can be recorded with the Unity Recorder.
Put an arrow image (.png), with a transparent background, of your choice into the Unity Assets folder in order to use the script.
Copy and paste this script to Microsoft Copilot ( https://copilot.microsoft.com ) to get the detailed instructions.
The script on this webpage was generated with Microsoft Copilot ( https://copilot.microsoft.com ). Copy and paste this script to Microsoft Copilot if you wish to understand this script.
using UnityEngine;
using UnityEngine.UI;
public class ArrowCursorRenderer : MonoBehaviour
{
public RectTransform cursorUI; // UI element representing the cursor
public Image cursorImage; // UI Image component (arrow)
void Start()
{
// Ensure the cursor starts hidden
cursorImage.enabled = false;
}
void Update()
{
// Move the cursor UI to follow the mouse
cursorUI.position = Input.mousePosition;
// Show the arrow only when mouse is pressed
cursorImage.enabled = Input.GetMouseButton(0);
}
}
YouTube (@nlartwork)