Files

27 lines
647 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
using UnityEngine.UI;
namespace utils
{
public class FileUtils
{
/// <summary>
/// Documentation text normalized.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static Sprite getImage(string path)
{
// Documentation text normalized.
Sprite sprite = Resources.Load<Sprite>(path);
if (sprite == null)
{
Debug.LogError($"无法在 Resources/{path} 下找到 Sprite");
return null;
}
return sprite;
}
}
}