Version: 2022.3

Undo.postprocessModifications

切换到手册
public static Undo.PostprocessModifications postprocessModifications ;

描述

每当创建一组新的属性修改时,将触发此回调。

另请参阅:PostprocessModifications

using UnityEditor;
using UnityEngine;

public class ExamplePostprocessModificationScript : MonoBehaviour { void Start() { Undo.postprocessModifications += MyPostprocessModificationsCallback; }

void OnDestroy() { Undo.postprocessModifications -= MyPostprocessModificationsCallback; }

UndoPropertyModification[] MyPostprocessModificationsCallback(UndoPropertyModification[] modifications) { // here, you can perform processing of the recorded modifications before returning them return modifications; } }