Setting Up the Default Inputs
Last updated
Was this helpful?
Last updated
Was this helpful?
The first thing to do is to create a setup script which will run once before any of your other scripts try to get input from cInput. Note that this setup script only needs to run once, so if you put it in the first scene the player will see (e.g., a splash screen or loading screen) then you don't need to include it in any other scenes. cInput will persist when changing scenes.
It is considered best practice to call in your Awake()
function to allow cInput to instantiate a GameObject
and load any customized settings. After that, you can define all of your default settings in the Start()
(or other) function, starting with defining actions
with followed by any axes
with , similar to what's shown below:
More details on how to use or can be found in the .
Remember: An
axis
cannot be defined until after itsactions
have been defined.
For a full list of acceptable inputs (as strings) see the section. Additionally, you can use to let autocomplete help you type in the correct keys. Many of the examples in this documentation take advantage of the Keys
class.