

Hello, I am trying to read in a JSON file that contains my dialogue for each customer in my game. I have looked at many tutorials and have gotten them to work, but when I try to change it to use nested lists, I cannot get it working. Here is a condensed version on what the JSON will look like. { { "timmy": [ "typeOfDialogue1": [ "version1": "heya1", "version2": "heya2", "version3": "heya3" ], "typeOfDialogue2": [ "version1": "heya4", "version2": "heya5", "version3": "heya6" ], "typeOfDialogue3": [ "version1": "heya7", "version2": "heya8", "version3": "heya9" ] ], "marge": [ "typeOfDialogue1": [ "version1": "hi1", "version2": "hi2", "version3": "hi3" ], "typeOfDialogue2": [ "version1": "hi4", "version2": "hi5", "version3": "hi6" ], "typeOfDialogue3": [ "version1": "hi7", "version2": "hi8", "version3": "hi9" ] ] } And here is what I currently have to read in each line of dialogue that is not working. using UnityEngine; using System; using System.Collections.Generic; public class ReadJSON : MonoBehaviour { [SerializeField] public TextAsset textJSON; [Serializable] public class Versions { public string version1; public string version2; public string version3; } [Serializable] public class TypeOfDialogue { public Versions typeOfDialogue1; public Versions typeOfDialogue2; public Versions typeOfDialogue3; } [Serializable] public class Customers { public TypeOfDialogue timmy; public TypeOfDialogue vanessa; } public Customers myCustomerList = new Customers(); void Start() { myCustomerList = JsonUtility.FromJson (textJSON.text); } } I was hoping to just be able to use this method and not have to install a JSON reader extension since I don’t really know how to do that. If that is the only option though, I will do that. Thank you for reading! 5 posts - 3 participants Read full topic
Unity Discussions
discussions.unity.com