Advertisement
Guest User

Untitled

a guest
May 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. // JSON FILE
  2. {
  3. "technologies" : [
  4. {
  5. "naming":"factory" ,
  6. "shortDescription":"Building that creates cars or bots." ,
  7. "longDescription":"Using this building..." ,
  8. "allows":["mechbay","airbay"]
  9. } ,
  10.  
  11. {
  12. "naming":"mechbay" ,
  13. "shortDescription":"Building that creates mechs." ,
  14. "longDescription":"Assemble your mechs here..." ,
  15. "allows":["satellite"]
  16. }
  17. ]
  18. }
  19.  
  20. // CODE FOR LOADING
  21. [System.Serializable]
  22. public class HolderClass
  23. {
  24. public string naming;
  25. public string shortDescription;
  26. public string longDescription;
  27. public List<string> allows = new List<string>();
  28. }
  29.  
  30. public class TechTreeDataLoading:MonoBehaviour {
  31.  
  32. List<HolderClass> allHolders = new List<HolderClass>();
  33.  
  34. void Start()
  35. {
  36. StreamReader sr = new StreamReader(Application.dataPath + "/Resources/skilltree/knowledgetree.json");
  37. allHolders = JsonUtility.FromJson<List<HolderClass>>(sr.ReadToEnd());
  38. sr.Close();
  39.  
  40. Debug.Log(allHolders.Count + "| COUNT ");
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement