File tree Expand file tree Collapse file tree
Packages/com.unity.inputsystem/InputSystem/Editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ internal static class InputActionAssetIconLoader
1313 {
1414 private const string kActionIcon = "Packages/com.unity.inputsystem/InputSystem/Editor/Icons/InputAction.png" ;
1515 private const string kAssetIcon = "Packages/com.unity.inputsystem/InputSystem/Editor/Icons/InputActionAsset.png" ;
16+ private const string kSettingsIcon = "Packages/com.unity.inputsystem/InputSystem/Editor/Icons/InputSettings.png" ;
1617
1718 /// <summary>
1819 /// Attempts to load the icon associated with an <see cref="InputActionAsset"/>.
@@ -32,6 +33,15 @@ internal static Texture2D LoadActionIcon()
3233 {
3334 return ( Texture2D ) EditorGUIUtility . Load ( kActionIcon ) ;
3435 }
36+
37+ /// <summary>
38+ /// Attempts to load the icon associated with an <see cref="InputSettings"/> asset.
39+ /// </summary>
40+ /// <returns>Icon resource reference or <code>null</code> if the resource could not be loaded.</returns>
41+ internal static Texture2D LoadSettingsIcon ( )
42+ {
43+ return ( Texture2D ) EditorGUIUtility . Load ( kSettingsIcon ) ;
44+ }
3545 }
3646}
3747
Original file line number Diff line number Diff line change @@ -211,7 +211,11 @@ private static void CreateNewSettingsAsset(string relativePath)
211211 {
212212 // Create and install the settings. This will lead to an InputSystem.onSettingsChange event which in turn
213213 // will cause us to re-initialize.
214- InputSystem . settings = InputAssetEditorUtils . CreateAsset ( ScriptableObject . CreateInstance < InputSettings > ( ) , relativePath ) ;
214+ var settings = ScriptableObject . CreateInstance < InputSettings > ( ) ;
215+ var icon = InputActionAssetIconLoader . LoadSettingsIcon ( ) ;
216+ if ( icon != null )
217+ EditorGUIUtility . SetIconForObject ( settings , icon ) ;
218+ InputSystem . settings = InputAssetEditorUtils . CreateAsset ( settings , relativePath ) ;
215219 }
216220
217221 private static void CreateNewSettingsAsset ( )
@@ -489,6 +493,13 @@ internal static void ForceReload()
489493 [ CustomEditor ( typeof ( InputSettings ) ) ]
490494 internal class InputSettingsEditor : UnityEditor . Editor
491495 {
496+ private void OnEnable ( )
497+ {
498+ var icon = InputActionAssetIconLoader . LoadSettingsIcon ( ) ;
499+ if ( icon != null )
500+ EditorGUIUtility . SetIconForObject ( target , icon ) ;
501+ }
502+
492503 public override void OnInspectorGUI ( )
493504 {
494505 EditorGUILayout . Space ( ) ;
You can’t perform that action at this time.
0 commit comments