Skip to content

The API

Cristian Geambasu edited this page Apr 5, 2018 · 2 revisions

The InputManager class provides the following methods and variables, in addition to the ones provided by Unity's Input class:

  • PlayerControlsChanged - This event is fired when you set a new control scheme for a player.
  • ControlSchemesChanged - This event is fired when you re-initialize the Input Manager.
  • Loaded - This event is fired when you call the Load method.
  • Saved - This event is fired when you call the Save method.
  • BeforeUpdate - This event is fired before the Input Manager is updated, at the start of the frame.
  • AfterUpdate - This event is fired after the Input Manager is updated, at the start of the frame.
  • RemoteUpdate - This event is fired when it's time to update *RemoteAxis and RemoteButton bindings for virtual input.
  • Exists - Use it to check if a InputManager instance exists in the game.
  • IsScanning - Use this to check if a scan is already running before starting a new one.
  • PlayerOneControlScheme - A reference to the active control scheme used by the Input Manager for player one.
  • PlayerTwoControlScheme - A reference to the active control scheme used by the Input Manager for player two.
  • PlayerThreeControlScheme - A reference to the active control scheme used by the Input Manager for player three.
  • PlayerFourControlScheme - A reference to the active control scheme used by the Input Manager for player four.
  • AnyInput - Returns true if any axis of any active control scheme is receiving input.
  • SetControlScheme - Changes the active control scheme.
  • GetControlScheme - Returns a reference to the requested control scheme.
  • GetAction - Returns a reference to the requested input action.
  • CreateControlScheme - Creates a new, empty control scheme.
  • DeleteControlScheme - Deletes the specified control scheme. If the speficied control scheme is active for any player then the active control scheme for the respective player will be set to null.
  • CreateButton - Creates a new button.
  • CreateDigitalAxis - Creates a new digital axis.
  • CreateMouseAxis - Creates a new mouse axis.
  • CreateAnalogButton - Creates a new analog button.
  • CreateAnalogAxis - Creates a new analog axis.
  • CreateRemoteButton - Creates a new remote button.
  • CreateRemoteAxis - Creates a new remote axis.
  • CreateEmptyAction - Creates a new, empty input action.
  • DeleteAction - Deletes an input action.
  • StartInputScan - Starts a new input scan.
  • StopInputScan - If an input scan is in progress it will be stopped.
  • Save - Saves the control schemes in an XML file, in Application.persistentDataPath or another file of your choosing.
  • Load - Loads the control schemes from an XML file, from Application.persistentDataPath or another file of your choosing.