When I hover a trigger, I want the cursor to change to a Texture2D of my choice, but I can't figure out how to change that variable.
I have this "Main" script on my camera to give a custom cursor:
using UnityEngine;
using System.Collections;
public class Main : MonoBehaviour {
public Texture2D cursorImage;
void Start()
{
Screen.showCursor = false;
}
void OnGUI()
{
GUI.DrawTexture(new Rect(Input.mousePosition.x - 64, Screen.height - Input.mousePosition.y - 64, 128, 128), cursorImage);
}
}
This is my trigger's "TriggerObject1" script
using UnityEngine;
using System.Collections;
public class TriggerTable1 : MonoBehaviour {
void OnMouseEnter()
{
//Switch cursor code
GameObject.Find("Main Camera").GetComponent<Main>().cursorImage = don't know what to put here;
}
}