暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }