Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

InputActionAssetIconLoader.cs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #if UNITY_EDITOR
  2. using UnityEditor;
  3. namespace UnityEngine.InputSystem.Editor
  4. {
  5. // Note that non-existing caching here is intentional since icon selected might be theme dependent.
  6. // There is no reason to cache icons unless there is a significant performance impact on the editor.
  7. /// <summary>
  8. /// Provides access to icons associated with <see cref="InputActionAsset"/> and <see cref="InputActionReference"/>.
  9. /// </summary>
  10. internal static class InputActionAssetIconLoader
  11. {
  12. private const string kActionIcon = "Packages/com.unity.inputsystem/InputSystem/Editor/Icons/InputAction.png";
  13. private const string kAssetIcon = "Packages/com.unity.inputsystem/InputSystem/Editor/Icons/InputActionAsset.png";
  14. /// <summary>
  15. /// Attempts to load the icon associated with an <see cref="InputActionAsset"/>.
  16. /// </summary>
  17. /// <returns>Icon resource reference or <code>null</code> if the resource could not be loaded.</returns>
  18. internal static Texture2D LoadAssetIcon()
  19. {
  20. return (Texture2D)EditorGUIUtility.Load(kAssetIcon);
  21. }
  22. /// <summary>
  23. /// Attempts to load the icon associated with an <see cref="InputActionReference"/> sub-asset of an
  24. /// <see cref="InputActionAsset"/>.
  25. /// </summary>
  26. /// <returns>Icon resource reference or <code>null</code> if the resource could not be loaded.</returns>
  27. internal static Texture2D LoadActionIcon()
  28. {
  29. return (Texture2D)EditorGUIUtility.Load(kActionIcon);
  30. }
  31. }
  32. }
  33. #endif // #if UNITY_EDITOR