Beispiel #1
0
 public void OnAfterDeserialize()
 {
     if (statsClone.stats != null)
     {
         stats.FromClone(statsClone);
     }
 }
Beispiel #2
0
        public static Stats FromJson(string json)
        {
            if (json == null || json == "")
            {
                return(new Stats());
            }
            SerializeableStats myClone = UnityEngine.JsonUtility.FromJson <SerializeableStats>(json);
            Stats stats = new Stats {
            };

            if (myClone.stats == null)
            {
                Debug.LogError("JSON Null inside stats:\n" + json);
                return(new Stats());
            }
            stats.FromClone(myClone);
            return(stats);
        }