Simple Custom 2D Pointer

From Unify Community Wiki
Jump to: navigation, search
This page is marked for deletion

Description

Apply this script to a GUITexture and it will replace the cursor with your own texture.

C# - CursorIcon.cs

using UnityEngine;
using System.Collections;
 
public class CursorIcon : MonoBehaviour {
 
	private float z;
 
	void Start () {
		Screen.showCursor = false;
		z = transform.position.z;
	}
 
	void Update () {
		float x = Input.mousePosition.x / Screen.width;
		float y = Input.mousePosition.y / Screen.height;
		transform.position = new Vector3 (x, y, z);	
	}
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox