There is some structure, for example:
[Serializable] public struct ArrowWalleyStats { public Damage damage; public float radius; public int countOfArrows; public float cooldown; } And there is a class that stores an instance of this structure, but, for some reason, stores it as a variable of type object . For example:
[Serializable] class ArrowWalley { object stats = new ArrowWalleyStats(); } When trying to serialize an ArrowWalley class object with the standard Unity class JsonUtility.ToJson(new ArrowWalley()); , the stats field is not serialized.
How can I serialize the stats field? Preferably, using the same standard JsonUtility class.