| Namespace: | Sirenix.OdinInspector.Editor |
| Assembly: | Sirenix.OdinInspector.Editor |
public sealed class PrefabModificationHandler : IDisposable
Handles all prefab modifications that apply to the targets of a property tree, if any. This class determines which properties have modifications, what the modifications are, auto-applies modifications if the current instance values do not correspond to the prefab values, and also provides an API for modifying those modifications.
NOTE: This class is liable to see a lot of changes, as the prefab modification system is slated to be redesigned for increased extendability in the future. Do not depend overly on the current API.
public PrefabModificationHandler(PropertyTree tree)
| PropertyTree | tree |
public bool HasNestedOdinPrefabData { get; }
public bool HasPrefabs { get; }
public PropertyTree PrefabPropertyTree { get; }
public ImmutableList<Object> TargetPrefabs { get; }
public PropertyTree Tree { get; }
public void CleanForCachedReuse()
public void Dispose()
public List<PrefabModification> GetPrefabModifications(int targetIndex)
| System.Int32 | targetIndex |
| System.Collections.Generic.List<PrefabModification> |
public PrefabModificationType? GetPrefabModificationType(InspectorProperty property, bool forceAutoRegister = false)
| InspectorProperty | property | The property to check. |
| System.Boolean | forceAutoRegister |
| System.Nullable<PrefabModificationType> | The prefab modification type of the property if it has one, otherwise null. |
public PropertyModification GetUnityPropertyModification(StringSlice path, int selectionIndex, out bool childrenHaveModifications)
| StringSlice | path | The property path to get the modification for. |
| System.Int32 | selectionIndex | The index of the tree target to get the modification for. |
| System.Boolean | childrenHaveModifications | Whether any children of the path have modifications registered. |
| UnityEditor.PropertyModification |
public void RegisterPrefabDictionaryAddKeyModification(InspectorProperty property, int targetIndex, object key)
| InspectorProperty | property | The property to register a modification for. |
| System.Int32 | targetIndex | Selection index of the target. |
| System.Object | key | The key to be added. |
| System.ArgumentException | Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property. |
public void RegisterPrefabDictionaryDeltaModification(InspectorProperty property, int targetIndex)
| InspectorProperty | property | The property to register a modification for. |
| System.Int32 | targetIndex | Selection index of the target. |
| System.ArgumentException | Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property. |
public void RegisterPrefabDictionaryRemoveKeyModification(InspectorProperty property, int targetIndex, object key)
| InspectorProperty | property | The property to register a modification for. |
| System.Int32 | targetIndex | Selection index of the target. |
| System.Object | key | The key to be removed. |
| System.ArgumentException | Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property. |
public void RegisterPrefabListLengthModification(InspectorProperty property, int targetIndex, int newLength)
| InspectorProperty | property | The property to register a modification for. |
| System.Int32 | targetIndex | Selection index of the target to register a modification for. |
| System.Int32 | newLength | The modified list length. |
| System.ArgumentException | Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property. or newLength cannot be negative! |
public void RegisterPrefabValueModification(InspectorProperty property, int targetIndex, bool forceImmediate = false)
| InspectorProperty | property | The property to register a modification for. |
| System.Int32 | targetIndex | Selection index of the target to register a modification for. |
| System.Boolean | forceImmediate | Whether to force the change to be registered immediately, rather than at the end of frame. |
| System.ArgumentException | Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property. |
public void RemovePrefabDictionaryModification(InspectorProperty property, int targetIndex, object key)
| InspectorProperty | property | The property to remove a key modification for. |
| System.Int32 | targetIndex | Selection index of the target. |
| System.Object | key | The key to remove modifications for. |
| System.ArgumentNullException | key |
public void RemovePrefabModification(InspectorProperty property, int targetIndex, PrefabModificationType modificationType)
| InspectorProperty | property | The property to remove modifications for. |
| System.Int32 | targetIndex | Selection index of the target. |
| PrefabModificationType | modificationType | Type of the modification to remove. |
public void Update()