Singularity/Library/PackageCache/com.unity.2d.animation@7.0.10/Editor/SkinningModule/IconUtility.cs

31 lines
1.1 KiB
C#
Raw Permalink Normal View History

2024-05-06 14:45:45 -04:00
using System.IO;
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal static class IconUtility
{
static public readonly string k_LightIconResourcePath = "SkinningModule/Icons/Light";
static public readonly string k_DarkIconResourcePath = "SkinningModule/Icons/Dark";
static public readonly string k_SelectedResourceIconPath = "SkinningModule/Icons/Selected";
public static Texture2D LoadIconResource(string name, string personalPath, string proPath)
{
string iconPath = "";
if (EditorGUIUtility.isProSkin && !string.IsNullOrEmpty(proPath))
iconPath = Path.Combine(proPath, "d_" + name);
else
iconPath = Path.Combine(personalPath, name);
if (EditorGUIUtility.pixelsPerPoint > 1.0f)
{
var icon2x = ResourceLoader.Load<Texture2D>(iconPath + "@2x.png");
if (icon2x != null)
return icon2x;
}
return ResourceLoader.Load<Texture2D>(iconPath+".png");
}
}
}