using System.IO;
using UnityEngine;
public static class LocalTextLoader
{
///
/// 从固定路径加载文本文件
///
/// 完整文件路径
/// 文本内容,失败返回 null
public static string LoadText(string filePath)
{
if (!File.Exists(filePath))
{
Debug.LogError($"[LocalTextLoader] 文件不存在: {filePath}");
return null;
}
try
{
return File.ReadAllText(filePath);
}
catch (System.Exception e)
{
Debug.LogError($"[LocalTextLoader] 读取文件失败: {e.Message}");
return null;
}
}
}