WuhuIslandTesting/Library/PackageCache/com.unity.splines@1.0.1/Editor/Utilities/PathIcons.cs

32 lines
1.3 KiB
C#
Raw Permalink Normal View History

2025-01-07 02:06:59 +01:00
using UnityEngine;
namespace UnityEditor.Splines
{
static class PathIcons
{
public static GUIContent knotPlacementTool = EditorGUIUtility.TrIconContent(GetIcon("KnotPlacementTool"), "Knot Placement Tool");
public static GUIContent splineMoveTool = EditorGUIUtility.TrIconContent("MoveTool", "Spline Move Tool");
public static GUIContent splineRotateTool = EditorGUIUtility.TrIconContent("RotateTool", "Spline Rotate Tool");
public static GUIContent splineScaleTool = EditorGUIUtility.TrIconContent("ScaleTool", "Spline Scale Tool");
static Texture2D GetIcon(string name)
{
bool is2x = EditorGUIUtility.pixelsPerPoint > 1;
bool darkSkin = EditorGUIUtility.isProSkin;
string path = string.Format($"Icons/{(darkSkin ? "d_" : "")}{name}{(is2x ? "@2x" : "")}");
Texture2D texture = Resources.Load<Texture2D>(path);
if (texture != null)
return texture;
path = string.Format($"Icons/{(darkSkin ? "d_" : "")}{name}");
texture = Resources.Load<Texture2D>(path);
if (texture != null)
return texture;
path = string.Format($"Icons/{name}");
return Resources.Load<Texture2D>(path);
}
}
}