- Home /
Custom mouse icon
So, for my start menu, I'm trying to have a custom mouse cursor icon, and it's there, but it's hidden behind my background for the start menu. Is there any way to move it "up" a layer? Here's the Javascript code for the mouse:
pragma strict
ar icon : Texture2D;
function Start() {
Screen.showCursor = false;
}
function OnGUI() {
var mousePos : Vector3 = Input.mousePosition;
var pos : Rect = Rect(mousePos.x,Screen.height - mousePos.y,icon.width,icon.height);
GUI.Label(pos,icon);
}
Answer by Huacanacha · Nov 05, 2013 at 03:51 PM
Yes, you can use GUI.depth, which specifies the relative 'depth' to draw GUI elements at. Lower values are drawn over the top of higher values. I think you can use negative values as it takes an int, so try using GUI.depth = -1.
http://docs.unity3d.com/Documentation/ScriptReference/GUI-depth.html
(I haven't used this myself so I'm just going on what the docs say...)