Adventure Creator Wikia

When AC's cursor is locked, it can optionally be displayed in the centre of the screen. However, it will still use the "Main cursor" texture assigned in the Cursor Manager.

This script allows you to display a separate texture, such as a crosshair, on-screen when the cursor is locked. To use it:

  1. Create a new C# script named Crosshair, and copy/paste the code below.
  2. Add a new Unity UI Canvas to the scene, and add an Image with a crosshair texture to it as a child, positioned in the centre of the screen.
  3. Add a Canvas Group component to the Canvas' root, and uncheck Interactable.
  4. To the same GameObject, add the new Crosshair component, and assign the Canvas Group in its Inspector.
  5. In AC's Settings Manager, check Hide cursor when locked in screen's centre?.


using UnityEngine;
using AC;

public class Crosshair : MonoBehaviour

	public CanvasGroup canvasGroup;

	private void Update ()
		if (canvasGroup) canvasGroup.alpha = KickStarter.playerInput.IsCursorLocked () ? 1f : 0f;