private void UpdateFirstDecoratorTypeName() { if (this.spDecorator.objectReferenceValue == null) { this.decoratorTypesNames[0] = "(none)"; } else { NodeIDecorator dectorator = (NodeIDecorator)this.spDecorator.objectReferenceValue; this.decoratorTypesNames[0] = dectorator.GetName(); } }
// PRIVATE METHODS: ----------------------------------------------------------------------- private void AssignDecorator(Type type) { if (this.spDecorator.objectReferenceValue != null) { DestroyImmediate(this.spDecorator.objectReferenceValue, true); } NodeIDecorator decorator = (NodeIDecorator)ScriptableObject.CreateInstance(type); decorator.hideFlags = HideFlags.HideInHierarchy; AssetDatabase.AddObjectToAsset(decorator, target); AssetDatabase.SaveAssets(); this.spDecorator.objectReferenceValue = decorator; this.serializedObject.ApplyModifiedProperties(); this.serializedObject.Update(); this.UpdateDecoratorEditor(); }