Unity-Editor

Undo.RecordObject

 [MenuItem("Example/Random Rotate")]
    static void RandomRotate()
    {
        var transform = Selection.activeTransform;
        if (transform)
        {
//注释之后无法回退
            Undo.RecordObject(transform, "Rotate " + transform.name);
            transform.rotation = Random.rotation;

        } 
    } 
posted @ 2020-05-12 17:58  天山鸟  阅读(130)  评论(0编辑  收藏  举报