Class InputControlPathEditor
Custom editor UI for editing control paths.
Implements
Namespace: UnityEngine.InputSystem.Editor
Assembly: Unity.InputSystem.dll
Syntax
public sealed class InputControlPathEditor : IDisposable
Remarks
This is the implementation underlying InputControlPathDrawer. It is useful primarily when greater control is required than is offered by the PropertyDrawer mechanism. In particular, it allows applying additional constraints such as requiring control paths to match ...
Constructors
InputControlPathEditor(SerializedProperty, InputControlPickerState, Action, GUIContent)
Initialize the control path editor.
Declaration
public InputControlPathEditor(SerializedProperty pathProperty, InputControlPickerState pickerState, Action onModified, GUIContent label = null)
Parameters
Type | Name | Description |
---|---|---|
SerializedProperty | pathProperty | string type property that will receive the picked input control path. |
InputControlPickerState | pickerState | Persistent editing state of the path editor. Used to retain state across domain reloads. |
Action | onModified | Delegate that is called when the path has been modified. |
GUIContent | label | Optional label to display instead of display name of |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Properties
onModified
Declaration
public Action onModified { get; }
Property Value
Type | Description |
---|---|
Action |
pathProperty
Declaration
public SerializedProperty pathProperty { get; }
Property Value
Type | Description |
---|---|
SerializedProperty |
Methods
Dispose()
Declaration
public void Dispose()
OnGUI()
Declaration
public void OnGUI()
OnGUI(Rect, GUIContent, SerializedProperty, Action)
Declaration
public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty property = null, Action modifiedCallback = null)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | |
GUIContent | label | |
SerializedProperty | property | |
Action | modifiedCallback |
SetControlPathsToMatch(IEnumerable<string>)
Declaration
public void SetControlPathsToMatch(IEnumerable<string> controlPaths)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | controlPaths |
SetExpectedControlLayout(string)
Constrain the type of control layout that can be picked.
Declaration
public void SetExpectedControlLayout(string expectedControlLayout)
Parameters
Type | Name | Description |
---|---|---|
string | expectedControlLayout | Name of the layout. This it the name as registered with RegisterLayout(Type, string, InputDeviceMatcher?). |
Remarks
// Pick only button controls.
editor.SetExpectedControlLayout("Button");
SetExpectedControlLayoutFromAttribute()
Declaration
public void SetExpectedControlLayoutFromAttribute()