I tried myself but it would only lock at random moments, and when it would, i couldn’t change where i looked. I am making a game where this would be very unwanted. Here is my code
#pragma strict
public var cursorTexture: Texture2D;
public var cursorMode: CursorMode = CursorMode.Auto;
public var hotSpot: Vector2 = Vector2.zero;
function OnMouseEnter() {
Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
}
function OnMouseExit() {
Cursor.SetCursor(null, Vector2.zero, cursorMode);
}
function Start () {
Screen.lockCursor = true;
}
function Update () {
Screen.lockCursor = true;
}