To use JSON in Unity, you either need to download one of the plugins (such as MiniJSON or SimpleJSON), write your own plugin or do what I've been doing.Basically just write out the JSON string manually yourself for upload and write code to sort the JSON string you download into usable code. Let us know if you have any questions on this, or run into any issues using it.ĭeadstarcgs said on Mon, 09 March 2015 at 2:30 AM The JsonUtil.cs file in the project has some helper functions which you may find useful, it you'd like to go that route: There's also JSON serialization/deserialization in the PlayFab Unity SDK itself (). Int serializedValue //need to write a list of int here if value= 0 we considere it null so we do not load moduleįor (int i =0 i< i++)įor (int s =0 s< s++)Ĭ = Instantiate (_m.db_guard.GetByID (serializedValue).prefab) as guardSlots īrendan Vanous said on Mon, 09 March 2015 at 4:00 PM do serialization stuff here with cityData It is based on JsonFX and C 4.0 dynamic feature. GameObject newCity = Instantiate (_m.db_City.GetByID (cityID).prefab) Ĭity cityScript = newShip.GetComponent () JsonConfig is a simple to use configuration library, allowing JSON based config files for your C/.NET application instead of cumbersome web.config/nfig xml files. Public void LoadPlayerCityPvp(int cityID,CityData cityData) Does anybody know how to properly serialize and deserialize a collection of polymorphic objects using JsonFX My serializer works, but the object that Im. Public class LoadPlayerCity : MonoBehaviour I know this isnt unity specific, but JsonFX seems to be the most often recommended Json library for Unity, so I thought you guys might be familiar with this (and it is for a Unity project). I have a database that allow me to instantiate a city prefab with all the city and guard spot already setup, only thing is guard spots are empty and i need to populate my guardspot list using a int guardIDList, I use the ID to have the prefab reference id my guard Database, now my problem is the docs do not explain how to use JSON in unity: using UnityEngine I am trying to do async pvp in my game, the same way as clash of clan where you visit CitiesĬities have Houses, Houses have guard spot ![]() ![]() ![]() In the past couple weeks JsonFX has broken for me on iOS devices (still works fine in the Editor). Started a topic on Sun, 08 March 2015 at 11:53 PM test project for Unit圓d 4.x + JsonFX 1.x (the project is named incorrectly, in the source code its named testColliders but that is just because theres really no good way to rename a project in Unity).
0 Comments
Leave a Reply. |