Quantcast
Channel: Answers by "IvovdMarel"
Viewing all articles
Browse latest Browse all 145

Answer by IvovdMarel

$
0
0
Using Dictionaries to read out JSON objects is very common but it's much easier to serialize it to a struct or class (which is also built-in to Unity using JsonUtilty.FromJson and JsonUtility.ToJson). Besides being an easier way to handle JSON, this should work on all platforms. void Start (){ string jsonString = File.ReadAllText(Application.dataPath + "/Resources/Items.json"))); MySpecificData data = JsonUtility.FromJson(); } public class MySpecificData{ public int id; public string title; public int rarity; public string description; public string classes; public string spritelocation; public int equipslot; public string prefablocation public bool stackable; }

Viewing all articles
Browse latest Browse all 145

Trending Articles