# Actions

An Action can represent any type of event that should take place as a result of input. Generally, Actions are named for the in-game action they represent, such as: Move Horizontal, Jump, Fire, Reload, Change Weapon, Punch, etc. Actions can also represent system actions such as Menu, Save, Load, Cancel, Back, Forward, etc. How you name and use Actions is entirely up to your game's needs.

Getting Input

Actions are generally how you get input in Rewired. Instead of getting input from a specific button on a specific controller which may change if the user switches controllers, you get input from the Action through the Player class. For example:

    private Rewired.Player player;

    void Awake() {
        player = Rewired.ReInput.players.GetPlayer(0); // get the player by id
    }

    void Update() {
        player.GetButtonDown("Fire");
    }

This way, you don't have to worry about what type or how many controllers the player is using -- you simply get your input based on the Action.

You can also get input based on the Action id instead. The Action id is displayed in the Rewired Editor under Actions. You can export a list of Action Id constants which adds the convenience of letting you use your IDE's auto-complete to find Actions when coding. Looking up Actions by id is significantly faster than by name and is the recommended method.

Additionally, you have the option of using input events instead of polling for input as shown in the above example. See How To's - Getting Input for more information.

Creating/Editing Actions

You must create and edit Actions in the Rewired Editor. See Rewired Editor - Actions for more information.

Players Input Behaviors