Created
August 28, 2016 04:24
-
-
Save scryptonite/d3a3f19563e18e67f923ed90a190fe33 to your computer and use it in GitHub Desktop.
LD36/Code/Scryptonite/ChangeCursor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @Scryptonite | |
* | |
* Just attach this component to any GameObject with a Collider. | |
* | |
* If you end up using my cursor set, the hotspot is pretty good at <23, 26>. | |
* | |
* You might want to update the Texture Type of whatever cursor you use to "Cursor". | |
* | |
* Don't forget to update the default cursor and hotspot under Edit/Project Settings/Player. | |
* | |
*/ | |
using UnityEngine; | |
public class ChangeCursor : MonoBehaviour { | |
public Texture2D mouseOverCursor; | |
public Vector2 hotspot = Vector2.zero; | |
public CursorMode cursorMode = CursorMode.Auto; | |
void OnMouseEnter() { | |
Cursor.SetCursor(mouseOverCursor, hotspot, cursorMode); | |
} | |
void OnMouseExit() { | |
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment