public SerializedPropertyX(SerializedObjectX serializedObjectX, string fieldName, Type type, object value) { this.serializedObjectX = serializedObjectX; this.type = type; this.value = value ?? CreateValue(type); originalValue = value; changed = false; name = fieldName; displayName = Util.SplitAndTitlize(fieldName); isExpanded = true; //todo find a way to get a unique id for these so we can save isExpanded between loads label = new GUIContent(displayName); BuildProperties(true); }
public override void OnInspectorGUI() { PlayerSkillBook skillBook = target as PlayerSkillBook; if (root == null) { if (!string.IsNullOrEmpty(skillBook.source)) { new AssetDeserializer(skillBook.source, false).DeserializeInto("__default__", skillBook); } root = new SerializedObjectX(target); } EditorGUILayoutX.DrawProperties(root); bool didChange = root.Root.ApplyModifiedProperties(); if (didChange) { AssetSerializer serializer = new AssetSerializer(); serializer.AddItem(target); serializedObject.FindProperty("source").stringValue = serializer.WriteToString(); serializedObject.ApplyModifiedProperties(); } }
public static void DrawProperties(SerializedObjectX obj) { DrawProperties(obj.Root); }
public virtual void Load() { serialRootObjectX = new SerializedObjectX(GetAssetCreator().Create()); }
public static void Draw(Rect position, SerializedObjectX obj) { }