-
Notifications
You must be signed in to change notification settings - Fork 332
NEW: Icon to InputSystem settings asset #2400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
c3b7eaf
9e001b3
16d7f4c
67db29c
c446b63
db57963
f706d52
c4f3bdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -211,7 +211,11 @@ | |||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| // Create and install the settings. This will lead to an InputSystem.onSettingsChange event which in turn | ||||||||||||||||||||||||||||||
| // will cause us to re-initialize. | ||||||||||||||||||||||||||||||
| InputSystem.settings = InputAssetEditorUtils.CreateAsset(ScriptableObject.CreateInstance<InputSettings>(), relativePath); | ||||||||||||||||||||||||||||||
| var settings = ScriptableObject.CreateInstance<InputSettings>(); | ||||||||||||||||||||||||||||||
| var icon = InputActionAssetIconLoader.LoadSettingsIcon(); | ||||||||||||||||||||||||||||||
| if (icon != null) | ||||||||||||||||||||||||||||||
| EditorGUIUtility.SetIconForObject(settings, icon); | ||||||||||||||||||||||||||||||
| InputSystem.settings = InputAssetEditorUtils.CreateAsset(settings, relativePath); | ||||||||||||||||||||||||||||||
|
Check warning on line 218 in Packages/com.unity.inputsystem/InputSystem/Editor/Settings/InputSettingsProvider.cs
|
||||||||||||||||||||||||||||||
|
Comment on lines
+214
to
+218
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When
Suggested change
🤖 Helpful? 👍/👎 |
||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| private static void CreateNewSettingsAsset() | ||||||||||||||||||||||||||||||
|
|
@@ -489,6 +493,13 @@ | |||||||||||||||||||||||||||||
| [CustomEditor(typeof(InputSettings))] | ||||||||||||||||||||||||||||||
| internal class InputSettingsEditor : UnityEditor.Editor | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| private void OnEnable() | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| var icon = InputActionAssetIconLoader.LoadSettingsIcon(); | ||||||||||||||||||||||||||||||
| if (icon != null) | ||||||||||||||||||||||||||||||
| EditorGUIUtility.SetIconForObject(target, icon); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Check warning on line 501 in Packages/com.unity.inputsystem/InputSystem/Editor/Settings/InputSettingsProvider.cs
|
||||||||||||||||||||||||||||||
|
Comment on lines
+496
to
+501
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is recommended to set the icon once during asset creation or via an 🤖 Helpful? 👍/👎 |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| public override void OnInspectorGUI() | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| EditorGUILayout.Space(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered caching the loaded
Texture2Din a static field? WhileEditorGUIUtility.Loadperforms some internal caching, maintaining a static reference in this loader class avoids the overhead of repeated lookups, which is beneficial since this method is called withinOnEnableof theInputSettingsEditor.🤖 Helpful? 👍/👎