Class InputControlPathEditor
Custom editor UI for editing control paths.
Namespace: UnityEngine.InputSystem.Editor
Syntax
public sealed class InputControlPathEditor : IDisposable
Remarks
This is the implementation underlying UnityEngine.InputSystem.Editor.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()
Implements
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, Nullable<InputDeviceMatcher>). |
Remarks
// Pick only button controls.
editor.SetExpectedControlLayout("Button");
SetExpectedControlLayoutFromAttribute()
Declaration
public void SetExpectedControlLayoutFromAttribute()