C# 完整序列化程序&;找不到fsSerializer-Unity
我发现了一些旧的Unity项目,但当我在Unity中打开它们时,我发现以下错误:C# 完整序列化程序&;找不到fsSerializer-Unity,c#,unity3d,C#,Unity3d,我发现了一些旧的Unity项目,但当我在Unity中打开它们时,我发现以下错误: 找不到类型或命名空间名称“FullSerializer” 找不到类型或命名空间名称“fsSerializer” 代码如下: using UnityEngine; using UnityEngine.Assertions; using FullSerializer; namespace Game.Core { /// <summary> /// Miscellaneous file ut
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;
}
}
}
使用UnityEngine;
使用UnityEngine.Assertions;
使用FullSerializer;
名称空间游戏.Core
{
///
///杂项文件实用程序。
///
公共静态类FileUtils
{
///
///加载指定的json文件。
///
///要使用的FullSerializer序列化程序。
///json文件路径。
///要加载的数据的类型。
///加载的json数据。
公共静态T LoadJsonFile(fsSerializer serializer,string path),其中T:class
{
var textAsset=Resources.Load(路径);
Assert.IsNotNull((textAsset));
var data=fsJsonParser.Parse(textAsset.text);
对象反序列化=空;
serializer.TryDeserialize(数据,typeof(T),ref反序列化)。AssertSuccessWithOutWarning();
返回反序列化为T;
}
///
///如果指定的路径存在,则返回true,否则返回false。
///
///这条路。
///如果指定的路径存在,则为True;否则为false。
公共静态bool文件存在(字符串路径)
{
var textAsset=Resources.Load(路径);
返回textAsset!=null;
}
}
}
您是否有可能遗漏了它,应该下载并集成到您的项目中?a)这是c
而不是unityscript
!b) 这与Unity一点关系都没有,而是缺少了一个库/插件/UnityPackage…是的,修复了它,谢谢。您是否碰巧缺少了它,应该下载并集成到您的项目中?a)这是c
而不是unityscript
!b) 这与Unity无关,而是缺少库/插件/UnityPackage…是的,修复了它,谢谢。