發表文章

目前顯示的是 8月, 2015的文章

Unity 如果使用 Google Admob (Android 版)

圖片
1. 首先當然 你需要 Admob 帳號  請參考這篇 http://imax-live.blogspot.tw/2012/11/admod-account-payment-paypal.html 2.申請完後,請先下載 Google Mobile Ads Unity Plugin 3.打開Unity -> Assert -> import Package -> Custom Package  4.匯入剛下載的GoogleMobileAds.unitypackage 5.匯入成功後,會看到專案下多了Plugin 資料夾 6.去自己的 Andorid SDK 資料夾 (沒有的話記得先去 下載   ) ,找到 Google Play Lib : [sdk]\extras\google\google_play_services\libproject\google-play-services_lib 7. 複製到 Unity Assert/Plugin 目錄下 8.在Unity 建立一個 場景(Sence) 9.建立一個按鈕的 , 並且有監聽事件的C# 的 Script 10. 在監聽事件中 貼上以下 code using GoogleMobileAds . Api ; … private void RequestBanner () {     #if UNITY_ANDROID         string adUnitId = "INSERT_ANDROID_BANNER_AD_UNIT_ID_HERE" ;     #elif UNITY_IPHONE         string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE" ;     #else         string adUnitId = "unexpected_platform" ;     #endif     // Create a 320x50 banner at the top of the screen.     BannerVie

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 ); }