Player input is how a player’s physical actions are translated into in-game responses. A common player input example in a game is a player pressing the space bar to make the character jump.
In Unreal Editor for Fortnite (UEFN), you can implement player input using Verse. The Verse Input API lets you control which inputs are active for a player and react when those inputs are triggered.
The /Verse.org/Input module provides a player_input class that serves as the main interface between your Verse code and a player's physical inputs. Through this class, you can activate sets of input actions, subscribe to events when those actions fire, and clean up when you no longer need them.
You can use the Input API to:
Listen for player actions, like jumping, firing, crouching, or reloading.
Enable or disable sets of inputs based on gameplay state, such as entering a vehicle, opening a menu, or picking up a weapon.
Track how long a player holds an input before it triggers or is released.
React to UI navigation inputs for custom menu interactions.
Input Actions and Input Mappings
The combination of input mappings and input actions gives you fine-grained control over what a player can do and when. For example, you can activate weapon inputs only when a player picks up a gun, or enable menu navigation inputs only when a UI panel is open.
Input action: A single bindable action that produces a value when triggered. The value type depends on the action. For example, button presses produce
logicvalues and analog values (like a gamepad trigger) producefloatvalues.Input mapping: A group of related input actions with default key bindings. It’s the context that tells the system the player can now perform these actions. For example,
TraversalMappinggroups together Jump, Sprint, and Crouch.
Input mappings must be added to a player before their input actions will produce events. Without the mapping active, subscriptions to its actions will not fire.
There are pre-built input actions available for you to use. They are organized into modules by category and each module provides input mappings and individual input actions.
Character Actions in /Fortnite.com/Input/Character
UI Actions in /Verse.org/Input/UI
Event Lifecycle
The system processes player input through a series of events. Understanding this lifecycle helps you decide which event you should subscribe to for your use case. You can find more details on the events in the Verse API Reference.
How To
For how to set up player input in your Verse code, check out the How To Add Player Input.