Nucleus handler tools โ€บ Docs โ€บ Game.ProtoInput โ€บ OnInputLocked

Game.ProtoInput.OnInputLocked

Open in the workbench (search, and try it in a handler)

Game.ProtoInput.OnInputLocked: () => void
AI-writtenAI-written. Based on: Nucleus LockInputRuntime.cs (opens in a new tab) (Lock); GenericGameHandler.cs (opens in a new tab) (after instance loop); Nucleus devtools AGENTS.md (opens in a new tab) (last player's Context).

Function Nucleus calls each time input is locked (the lock key, the gamepad lock shortcut or Game.LockInputAtStart), and once after all instances are set up if input is locked by then. It sees the last player's Context.

AI-writtenAI-written. Based on: Nucleus ProtoInputOptions.cs (opens in a new tab) (public Action OnInputLocked); LockInputRuntime.cs (opens in a new tab) (OnInputLocked?.Invoke()); Verified Hub handlers, counted 2026-11-17 (opens in a new tab).

In practice

Runs once when the player locks the input (the lock key, End by default), with no arguments, so handlers loop over PlayerList and act on each player.ProtoInputInstanceHandle. They use it to switch Proto Input on only while input is locked: ProtoInput.InstallHook, ProtoInput.EnableMessageFilter, ProtoInput.SetDrawFakeCursor(โ€ฆ, true), ProtoInput.StartFocusMessageLoop, undone in Game.ProtoInput.OnInputUnlocked. Context in it is the last player's.

Is "In practice" right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).
AI-writtenAI-written. Based on: Nucleus ProtoInputOptions.cs (opens in a new tab) (public Action OnInputLocked); LockInputRuntime.cs (opens in a new tab) (OnInputLocked?.Invoke()); Verified Hub handlers, counted 2026-11-17 (opens in a new tab).

Example

Game.ProtoInput.OnInputLocked = function () {
  for (var i = 0; i < PlayerList.Count; i++) {
    var handle = PlayerList[i].ProtoInputInstanceHandle;
    ProtoInput.InstallHook(
      handle,
      ProtoInput.Values.GetCursorPosHookID
    );
    ProtoInput.EnableMessageFilter(
      handle,
      ProtoInput.Values.RawInputFilterID
    );
    ProtoInput.SetDrawFakeCursor(handle, true);
  }
};
Is the doc right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).

Handler API docs

Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop