This feature is in an Experimental state so you can try it out, provide feedback, and see what we are planning. You cannot publish a project that uses Player Input Device Info API at this time. Please keep in mind that we do not guarantee backward compatibility for assets created at the experimental stage. The APIs for these features are subject to change, and we may remove entire Experimental features or specific functionality at our discretion.
Build adaptive gameplay and UI by reading the input capabilities and context of each player's device. The Player Input Device Info API extends the player_input class with two new properties that let you understand not just which inputs exist, but how a player is physically interacting with the game.
Many devices support multiple input types at the same time. For example, a Nintendo Switch supports both gamepad and touch simultaneously. AvailableInputDevices gives you the full hardware picture, while PreferredInputMethod gives you a single high-level category useful for decisions like whether to show a touch-centric or gamepad-centric UI.
About Available Input Device Input Methods
Available input devices describe the hardware capabilities currently active on a player's device. Each capability is a logic field on the available_input_devices struct. Because multiple capabilities can be true at once, this struct gives you the full picture of what the hardware supports.
An input method is a high-level category representing how a player is primarily interacting with the game. Even when a device supports multiple input types, PreferredInputMethod resolves to a single value so your code can make straightforward branching decisions.
What the Player Input Device Info API Does
Reports the full set of active input hardware through
AvailableInputDevices.Identifies a player's preferred input category through
PreferredInputMethod.
What You Can Do
You can use the Player Input Device Info API to:
Show the correct button prompts (gamepad icons, touch icons, or keyboard shortcuts) based on how the player is actually playing.
Build UI layouts that adapt to the player's form factor; such as compact mobile layouts, large-text TV layouts, and so on.
Support platforms that use multiple input types simultaneously by querying all available devices rather than relying on a single assumed input.
Available Input Devices
The available_input_devices struct describes the hardware input capabilities available to a player. Each field is a logic value indicating whether that capability is present. Import it with:
using { /Verse.org/Input }.| Field | Value Type | Description |
|---|---|---|
Gamepad | logic | Whether a gamepad is connected. |
Keyboard | logic | Whether a keyboard is connected. |
Mouse | logic | Whether a mouse is connected. |
Touch | logic | Whether a touch input is available. |
Input Method
The input_method enum is a high-level categorization of how a player is primarily interacting with the game. Import it with:
using { /Verse.org/Input }.| Value | Description |
|---|---|
KeyboardAndMouse | The player is primarily using a keyboard and mouse. |
Gamepad | The player is primarily using a gamepad. |
Touch | The player is primarily using touch input. |
Using Player Input Device Info in Verse
The following walks through how to import the module, retrieve a player's input data, and branch your logic based on their preferred input method or available hardware.
Import the Module
using { /Verse.org/Input }
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }Get Player Input and Read Properties
GetPlayerInput is a failable function and must be called within a failure context. Once you have the player_input instance, read the device info properties directly:
if (PlayerInput := GetPlayerInput[Player]):
Devices := PlayerInput.AvailableInputDevices
Method := PlayerInput.PreferredInputMethod
FormFactor := PlayerInput.InputFormFactor
Branch on Preferred Input Method
Use PreferredInputMethod to decide which UI style to present:
if (PlayerInput := GetPlayerInput[Player]):
case (PlayerInput.PreferredInputMethod):
input_method.Gamepad => ShowGamepadUI()
input_method.Touch => ShowTouchUI()
input_method.KeyboardAndMouse => ShowKeyboardMouseUI()
_=>Check for Specific Hardware
Use AvailableInputDevices when you need to confirm that specific hardware is present before enabling a feature:
if (PlayerInput := GetPlayerInput[Player]):
if (PlayerInput.AvailableInputDevices.Touch?):
EnableTouchAiming()
if (PlayerInput.AvailableInputDevices.Mouse?):
EnableMouseTargeting()Complete Example
The following example demonstrates a device that reads each player's input device info on join and adapts its UI and features accordingly.
using { /Fortnite.com/Devices }
using { /Verse.org/Input }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
input_device_info_example := class(creative_device):
OnBegin<override>()<suspends> : void =
for (Player : GetPlayspace().GetPlayers()):
AdaptToPlayer(Player)
Tips for Using Player Input Device Info
The following tips can help you work effectively with the Player Input Device Info API:
Use
PreferredInputMethodfor most UI decisions. It resolves to a single value even on platforms that support multiple input types simultaneously, keeping your branching logic simple.Use
AvailableInputDeviceswhen a feature requires specific hardware. This will prevent unexpected behavior on devices that lack that hardware.Read device info properties at player join time, and again if the player's device context may change, such as when a player switches from keyboard and mouse to gamepad.