c# - 找不到 FullSerializer 和 fsSerializer - Unity
问题描述
我发现了一些旧的 Unity 项目,但是当我在 Unity 中打开它们时,我得到了这个错误:
找不到类型或命名空间名称“FullSerializer”。
找不到类型或命名空间名称“fsSerializer”。
这是代码:
using UnityEngine;
using UnityEngine.Assertions;
using FullSerializer;
namespace Game.Core
{
/// <summary>
/// Miscellaneous file utilities.
/// </summary>
public static class FileUtils
{
/// <summary>
/// Loads the specified json file.
/// </summary>
/// <param name="serializer">The FullSerializer serializer to use.</param>
/// <param name="path">The json file path.</param>
/// <typeparam name="T">The type of the data to load.</typeparam>
/// <returns>The loaded json data.</returns>
public static T LoadJsonFile<T>(fsSerializer serializer, string path) where T : class
{
var textAsset = Resources.Load<TextAsset>(path);
Assert.IsNotNull((textAsset));
var data = fsJsonParser.Parse(textAsset.text);
object deserialized = null;
serializer.TryDeserialize(data, typeof(T), ref deserialized).AssertSuccessWithoutWarnings();
return deserialized as T;
}
/// <summary>
/// Returns true if the specified path exists and false otherwise.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>True if the specified path exists; false otherwise.</returns>
public static bool FileExists(string path)
{
var textAsset = Resources.Load<TextAsset>(path);
return textAsset != null;
}
}
}
解决方案
推荐阅读
- javascript - Pagespeed Insights 页面得分使用 Adsense 下降
- javascript - 为什么我的 Javascript 幻灯片无法正常工作
- string - Golang 追加和删除字符的优化方法是什么
- c - C中的函数问题(可读性)
- css - 通过 CSS 类将自定义字体添加到引导类行?
- docker - 启动 Docker VPN 容器会杀死其他容器中的互联网
- reactjs - 带有反应 js 的样式化组件
- python - 在相当简单的 GUI 中调用 tkraise() 时出现网格布局问题
- html - 将 box-shadow 应用于 Bootstrap 4 卡片组件
- python - 仅包含 2 个输入列表之间共有元素的列表(如果没有重复,我无法做到)