Beispiel #1
0
            /// <summary>
            /// Updates all non modified properties in the prototype hierarchy. Works in reverse.
            /// </summary>
            public void UpdatePrototypeHierachy()
            {
                Stack <PrototypeObject> stack     = new Stack <PrototypeObject>();
                PrototypeObject         prototype = serializedObject.FindProperty("prototype").objectReferenceValue as PrototypeObject;

                while (prototype != null)
                {
                    stack.Push(prototype);

                    if (prototype == prototype.prototype)
                    {
                        break;
                    }

                    prototype = prototype.prototype;
                }

                if (stack.Count == 0)
                {
                    return;
                }

                while (stack.Count > 0)
                {
                    SerializedPrototypeEditor serializedObjectEditor = new SerializedPrototypeEditor(new SerializedObject(stack.Pop()));
                    serializedObjectEditor.UpdateNonModifiedProperties();
                }

                prototypeSerialized.Update();
            }
Beispiel #2
0
 /// <summary>
 /// Updates all prototypes in Assets/.
 /// </summary>
 public static void UpdateAllPrototypes()
 {
     foreach (string assetGUID in AssetDatabase.FindAssets("t:Prototype"))
     {
         SerializedPrototypeEditor serializedPrototypeEditor = new SerializedPrototypeEditor(new SerializedObject(AssetDatabase.LoadAssetAtPath <PrototypeObject>(AssetDatabase.GUIDToAssetPath(assetGUID))));
         serializedPrototypeEditor.UpdatePrototypeHierachy();
         serializedPrototypeEditor.serializedObject.ApplyModifiedProperties();
     }
 }
Beispiel #3
0
 void OnDisable()
 {
     SerializedPrototypeEditor.UpdateAllPrototypes();
 }
Beispiel #4
0
 void OnEnable()
 {
     serializedPrototypeObject = new SerializedPrototypeEditor(serializedObject);
     serializedPrototypeObject.UpdatePrototypeHierachy();
 }