|
|
|
|
|
|
|
|
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) |
|
|
|
{ |
|
|
|
var asset = property.FindPropertyRelative("playerInput"); |
|
|
|
var playerInput = property.FindPropertyRelative("playerInput"); |
|
|
|
EditorGUI.PropertyField(position, asset, new GUIContent("Player Input")); |
|
|
|
EditorGUI.PropertyField(position, playerInput, new GUIContent("Player Input")); |
|
|
|
var paths = GetPaths(asset.objectReferenceValue as InputActionAsset); |
|
|
|
var paths = GetPaths(playerInput.objectReferenceValue as PlayerInput); |
|
|
|
int selected = paths.IndexOf(path.stringValue); |
|
|
|
selected = EditorGUI.Popup(position, "Action", selected, paths); |
|
|
|
if(GUI.changed) |
|
|
|
|
|
|
EditorGUI.indentLevel--; |
|
|
|
} |
|
|
|
|
|
|
|
string[] GetPaths(InputActionAsset asset) |
|
|
|
string[] GetPaths(PlayerInput playerInput) |
|
|
|
if (asset == null) |
|
|
|
if (playerInput == null || playerInput.actions == null) |
|
|
|
foreach(var map in asset.actionMaps) |
|
|
|
foreach(var map in playerInput.actions.actionMaps) |
|
|
|
{ |
|
|
|
if (map == null) continue; |
|
|
|
foreach(var action in map.actions) |
|
|
|