GUI with own mouse

Hi, I turned off the system mouse with

Screen.showCursor = false; 

and made my own mousepointer with a texture thats follow the mouse.

var mousePos : Vector3 = Input.mousePosition;
var pos : Rect = Rect(mousePos.x,Screen.height - mousePos.y,cursorImage.width,cursorImage.height);
GUI.Label(pos,cursorImage); 

But now, my mouse its behind all GUI elements. Is there something to put the mouse over the GUI?

Put the mouse cursor code in its own script, and set GUI.depth for that script so it's drawn first. By the way, you should use Event.current.mousePosition instead of Input.mousePosition. That way you don't have to translate between screen space and GUI space.

Draw the mouse cursor last (or first), and make sure your GUI is all in one script. GUI is rendered in order of statement execution, so if it's behind everything else, put it at the opposite end of the script.

If you have multiple scripts that draw the GUI, unfortunately there's little you can do to control the order of script execution. From what I've read, it seems the script execution order is somewhat random, though you could try placing your script inside one of Unity's special folders, such as the Plugins/ folder. This MAY cause it to compile and run first, but I'm not sure, and I wouldn't bank on it.

Edit: As Eric said, you can also change the GUI.depth property to change the GUI layering.

I have had little luck with depth, but windows work great for the cursor :)

GUI.Window((int)WindowsID.MouseCursor, cursorRect, DrawCursor, "", GUIStyle.none);
GUI.BringWindowToFront((int)WindowsID.MouseCursor);

private void DrawCursor(int id)
{
    GUI.DrawTexture(new Rect(0, 0, cursorRect.width, cursorRect.height), currentCursor, ScaleMode.ScaleToFit, true);
}

Or else you could implement a GUI draw order script. Only thing is that you get all your OnGUI in one method, dunno if that is good or bad..