Input System  v0.1
ISX.InputControlPath Class Reference

Functions to working with control path specs (like "/gamepad/*stick"). More...

Static Public Member Functions

static string TryGetDeviceTemplate (string path)
 

Detailed Description

Functions to working with control path specs (like "/gamepad/*stick").

The thinking here is somewhat similar to System.IO.Path, i.e. have a range of static methods that perform various operations on paths.

Has both methods that work just on paths themselves (like TryGetControlTemplate) and methods that work on paths in combination with controls (like TryFindControls).

Member Function Documentation

◆ TryGetDeviceTemplate()

static string ISX.InputControlPath.TryGetDeviceTemplate ( string  path)
static

This function will only use information available in the path itself or in templates referenced by the path. It will not look at actual devices in the system. This is to make the behavior predictable and not dependent on whether you currently have the right device connected or not.

Note that this function allocates and causes GC.

Parameters
pathA control path (like "/<gamepad>/leftStick")
Returns
The name of the device template used by the given control path or null if the path does not specify a device template or does so in a way that is not supported by the function.
Exceptions
ArgumentNullExceptionpath is null
InputControlPath.TryGetDeviceTemplate("/<gamepad>/leftStick"); // Returns "gamepad".
InputControlPath.TryGetDeviceTemplate("/*/leftStick"); // Returns "*".
InputControlPath.TryGetDeviceTemplate("/gamepad/leftStick"); // Returns null. "gamepad" is a device name here.