Example #1
0
        private static Object getObjectFor(IsoUnityList list, object o)
        {
            if (o == null)
            {
                return(null);
            }

            Object uo = null;

            if (o is Object)
            {
                uo = o as Object;
            }
            else
            {
                uo = IsoUnityTypeFactory.Instance.getIsoUnityType(o);
                #if UNITY_EDITOR
                if (Application.isEditor && !Application.isPlaying &&
                    (UnityEditor.AssetDatabase.IsMainAsset(list) || UnityEditor.AssetDatabase.IsSubAsset(list)))
                {
                    (uo as ScriptableObject).hideFlags = HideFlags.HideInHierarchy;
                    UnityEditor.AssetDatabase.AddObjectToAsset(uo as Object, list);
                }
            #endif
            }
            return(uo);
        }
        public override void fromJSONObject(JSONObject json)
        {
            List <JSONObject> ljo = json.list;

            if (this.l == null)
            {
                this.l = ScriptableObject.CreateInstance <IsoUnityList>();
            }
            else
            {
                this.l.Clear();
            }
            foreach (var jo in ljo)
            {
                JSONAble unserialized = JSONSerializer.UnSerialize(jo);
                this.l.Add(unserialized);
            }
        }