Adding Json.Net to a Unity3D project

后端 未结 8 2231
清酒与你
清酒与你 2020-12-07 00:46

I added the Json.Net library to Visual Studio 2013 via NuGetpackage and installed it for NetFramework 4.5. I don\'t get an error in Visual Studio when I add

u

相关标签:
8条回答
  • 2020-12-07 01:10

    I have stumbled upon this project https://github.com/SaladLab/Json.Net.Unity3D

    Newtonsoft Json.NET is a de facto standard JSON library in .NET ecosystem. But it doesn't support Unity3D, so it's a little bit hard to use JSON.NET just after getting Json.NET package. This package is for Unity3D programmers that need to use latest Json.NET in Unity3D.

    Just import the unity package and you are good to go.

    0 讨论(0)
  • 2020-12-07 01:10

    If you adding reference to *.dll through IDE and after recompile IDE throws out, check if you have assembly definition. If so, you need to add it to Assembly References. It worked for me. Inspector

    0 讨论(0)
  • 2020-12-07 01:12

    I had just the same problem in Visual Studio 2015. But Utamaru's solution worked for me.

    Make a folder: Assets/Plugins where you put the *.dll file and add it as a reference.

    To add a reference you highlight the Analyzers in the Solution Explorer in Visual Studio and under Project > Add Reference you can find your *.dll file located in Assets/Plugin by browsing to it.

    0 讨论(0)
  • 2020-12-07 01:12

    You need to add the dll to your projects references.

    References >> Add Reference.

    0 讨论(0)
  • 2020-12-07 01:21

    For support in built versions, recommended to use one of following

    • Json.NET v12.0 github.com/jilleJr/Newtonsoft.Json-for-Unity
    • Json.NET v9.0 github.com/SaladLab/Json.Net.Unity3D
    • Json.NET v8.0 parentelement.com/assets/json_net_unity
    • Json.NET v7.0 nuget.org/packages/Unity.Newtonsoft.Json/

    Or if you dont require Newtonsoft.Json (Json.NET), here's some other alternatives (all works in Unity, I've omitted libraries that don't, and there's a lot of 'em):

    • OdinSerializer github.com/TeamSirenix/odin-serializer
    • UTF8Json github.com/neuecc/Utf8Json
    • FastJSON assetstore.unity.com/packages/tools/input-management/fastjson-27220
    • UltimateJson assetstore.unity.com/packages/tools/integration/ultimate-json-60845
    • SimpleJson wiki.unity3d.com/index.php/SimpleJSON
    • LitJson github.com/Mervill/UnityLitJson
    • FullSerializer github.com/jacobdufault/fullserializer
    • protobuf-net github.com/protobuf-net/protobuf-net

    There is quite the table of candy to select from. Choose well young padawan~

    0 讨论(0)
  • 2020-12-07 01:24

    Use simpleJson. Its free and gets the work done.

    Copy the SimpleJSON.cs contents into a newly created file in your project and you're ready to go. If you want to be fancy -> create this new file in assets\plugins directory

    http://wiki.unity3d.com/index.php/SimpleJSON

    0 讨论(0)
提交回复
热议问题