using UnityEngine; using UnityEngine.UI; namespace utils { public class FileUtils { /// /// 在unity resource内路径读取Img对象 /// /// /// public static Sprite getImage(string path) { // 从 Resources 加载 Sprite Sprite sprite = Resources.Load(path); if (sprite == null) { Debug.LogError($"无法在 Resources/{path} 下找到 Sprite!"); return null; } return sprite; } } }