free Tutorial

Very Simplest Unity Custom Cursor Script

Nabeel
July 13, 2014
0 Comments
Home
free
Tutorial
Very Simplest Unity Custom Cursor Script
Unity default cursor settings are not really works in player setting they will show you cursor in unity engine but in web player after you build the game,

I found in lots of forums about unity cursor scripts that people gives really hard methods for custom cursor, so today i found really awesome and clever script, here we got to the Very Simplest Unity Custom Cursor Script.

Steps:


  • create new java script and name it customcursor.js
  • now past the following code in the script.

var yourCursor : Texture2D;  // Your cursor texture
var cursorSizeX : int = 16;  // Your cursor size x
var cursorSizeY : int = 16;  // Your cursor size y

function Start()

{

    Screen.showCursor = false;

}

function OnGUI()

{

    GUI.DrawTexture (Rect(Event.current.mousePosition.x-cursorSizeX/2, Event.current.mousePosition.y-cursorSizeY/2, cursorSizeX, cursorSizeY), yourCursor);

}



  • Now drag this script on camera and set you desired cursore texture to the texture field.

Thats all


sell also:Some Health Scripts You should see!

If you find this post usefull then just subscribe us,
And join our Facebook group with Lots of great developers.


Blog authors

No comments