cursor locking a custom cursor.

Hi I just want to keep a custom cursor centered.

When I use cursor lock it just disappears. Before a build, hitting esc can make the custom cursor appear, but after a build it is just invisible.

It would be great if I can keep the 2D texture graphic I’ve made centered during game play.

Any advice would be great.

var yourCursor : Texture2D;
var cursorSizeX : int = 16;
var cursorSizeY : int = 16;

function Start ()
{
Screen.showCursor = false;
}
  function Update ()
{

//Screen.lockCursor = true;
}
 
  function OnGUI ()
  {
  GUI.DrawTexture (Rect(Event.current.mousePosition.x-cursorSizeX/2, Event.current.mousePosition.y-cursorSizeY/2,cursorSizeX, cursorSizeY), yourCursor);
 
   }