No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EditorIconUtility.cs 936B

1234567891011121314151617181920212223242526272829
  1. using System.IO;
  2. using UnityEngine;
  3. namespace UnityEditor.U2D.Animation
  4. {
  5. internal static class EditorIconUtility
  6. {
  7. public const string LightIconPath = "EditorIcons/Light";
  8. public const string DarkIconPath = "EditorIcons/Dark";
  9. public static Texture2D LoadIconResource(string name, string lightPath, string darkPath)
  10. {
  11. var iconPath = "";
  12. if (EditorGUIUtility.isProSkin && !string.IsNullOrEmpty(darkPath))
  13. iconPath = Path.Combine(darkPath, "d_" + name);
  14. else
  15. iconPath = Path.Combine(lightPath, name);
  16. if (EditorGUIUtility.pixelsPerPoint > 1.0f)
  17. {
  18. var icon2x = ResourceLoader.Load<Texture2D>(iconPath + "@2x.png");
  19. if (icon2x != null)
  20. return icon2x;
  21. }
  22. return ResourceLoader.Load<Texture2D>(iconPath+".png");
  23. }
  24. }
  25. }