Unity C# 如何匯入 JSON.net (Newtonsoft.Json.Net20.dll)

之前匯入 Newtonsoft.Json 一直會遇到compiler error,結果是匯入的dll 有分

不多說趕快看下面說明

1. 先到官網下載  http://json.codeplex.com/



2.點擊"Downloads"

3.選擇自己Unity 對應的 .net 版本



4.下載並解開壓縮檔,到bin 目錄

5.選擇 "DotNet20" 目錄
6.複製 Newtonsoft.Json.Net20.dll


7 在自己的Unity Project 中創立 Lib 目錄


8.將剛複製的dll 拖曳到此 目錄 就大功告成了


然後就可以使用 Json 了

example

public static T Clone<T>(T source)
{
    var serialized = JsonConvert.SerializeObject(source);
    return JsonConvert.DeserializeObject<T>(serialized);
}


留言

這個網誌中的熱門文章

angular 如何Http 如何設定 CORS (Cross-Origin Resource Sharing)

Google Map 單車路徑計算坡度和角度小工具

Google URL Shortener API 快速教學