result | EditorAction 完成时的状态。 |
使用特定结果完成 EditorAction。
调用此方法以使用 EditorActionResult 强制结束活动的 EditorAction。一个常见的用法是在实现不需要交互的原子操作时。
using UnityEngine; using UnityEditor; using UnityEditor.Actions; public class SingleFrameActionSample : EditorAction { [MenuItem("Test/Start Single Frame Action")] static void StartEditorActionSample() { Start(new SingleFrameActionSample(4)); } int m_Value; public SingleFrameActionSample(int value) { m_Value = value; Finish(EditorActionResult.Success); } protected override void OnFinish(EditorActionResult result) { m_Value += 2; Debug.Log($"Action Finished [{result}] with value: {m_Value}"); } }