Previous: , Up: Camera   [Contents][Index]


4.3 Cursor Lock

Component: CursorLock

This component allows the cursor to hide/unhide based on messages sent from other components, or just when the player clicks on the game. By default, it hides the cursor when the player moves with WASD and unlocks when the player presses [ESCAPE] or [CTRL]

Field of CursorLock: KeyCode[] unLockKeys

List of keys that unlock the mouse

Default value: new KeyCode[] {KeyCode.Escape, KeyCode.LeftControl}

Field of CursorLock: KeyCode[] lockKeys

List of keys that lock the mouse

Default value: new KeyCode[] {KeyCode.W, KeyCode.A, KeyCode.S, KeyCode.D}

Available Messages

Message on CursorLock: LockMouse ()

Locks and hides the cursor when receiving a message from a message sender.

Message on CursorLock: UnLockMouse ()

Unlocks and reveals the cursor when receiving a message from a message sender.

Field of CursorLock: KeyCode[] unLockKeys

List of keys that unlock the mouse

Default value: new KeyCode[] {KeyCode.Escape, KeyCode.LeftControl}

Field of CursorLock: KeyCode[] lockKeys

List of keys that lock the mouse

Default value: new KeyCode[] {KeyCode.W, KeyCode.A, KeyCode.S, KeyCode.D}

Available Messages

Message on CursorLock: LockMouse ()

Locks and hides the cursor when receiving a message from a message sender.

Message on CursorLock: UnLockMouse ()

Unlocks and reveals the cursor when receiving a message from a message sender.