在 Rider 中找不到使用 Unity.Plastic.Newtonsoft.Json

J. *_*man 1 unity-game-engine rider

我正在尝试使用:

using Unity.Plastic.Newtonsoft.Json
public static List<Level> GetLevels()
{
    var asset = Resources.Load<TextAsset>("levels.json".Replace(".json", ""));
    return JsonConvert.DeserializeObject<List<Level>>(asset.text);
}
Run Code Online (Sandbox Code Playgroud)

并且JsonConvert是红色的。并且Plastic显示为红色。它说无法解析符号塑料。

有任何想法吗?

编辑:我确实安装了 Newtonsoft.Json 版本 13 作为程序集。没有运气。

编辑:使用 Newtonsoft.Json;也红色。

J. *_*man 5

经过一番挖掘后确定:

显然更新了 Unity 项目,它消除了通过包管理器 > 从 git URL 添加包添加的依赖项

Unity 忘记了对此进行记录的更改。所以,答案是:

Package Manager Window > Add Package from GIT URL > com.unity.nuget.newtonsoft-json

不是使用using Unity.Plastic.Newtonsoft.Json

使用using Newtonsoft.Json;

注意:在手动添加的旧项目中,Newtonsoft Json 没有显示在包管理器 > 包:在项目中,直到我转到齿轮 > 选中显示依赖项。