Hey guys! I’m working on creating a flexible Unit Editor scene within unity to allow me to more easily mass-produce different kinds of units for my game. I want to store the data of each unit as multi-layered/nested JSON objects. For instance, every Unitdata JSON object has within it ParameterData, AnimationData, and CodexData which then each have child parameters, etc.
Now, I’ve followed a couple of tutorials but none of them are dealing with a situation quite as complex as mine.
Each of them are simply pulling from single JSON objects that have a bunch of properties, and in their scripts/code they have a matching Class that represents the entire JSON object and all of its properties.
So my question is this: do I really have to make a class(object) for every single sub-object within my JSON?
Like do I need to make a ParameterData class and a CodexData class, etc? and then my UnitData class simply has properties made of all of its child classes?
And then… when I do JsonUtility.FromJson/ToJson, if I pass in the most parent object, will it be able to automatically get all of the data within all of those child objects? Like will I need to loop/enumerate through all the objects somehow, or anything like that?
Here is my .json file I’m working with, if it helps: