首页 > 其他分享 >UnityEditor Undo

UnityEditor Undo

时间:2022-08-26 14:15:41浏览次数:56  
标签:UnityEditor transform Undo 组件 go myGameObject

最重要的几项操作如下所述:

修改单个属性:

Undo.RecordObject (myGameObject.transform, "Zero Transform Position");
myGameObject.transform.position = Vector3.zero;

添加组件:

Undo.AddComponent<RigidBody>(myGameObject);

创建新的游戏对象:

var go = new GameObject();
Undo.RegisterCreatedObjectUndo (go, "Created go");

// 注意:不需要手动调用以下代码标记“脏”,会自动标记“脏”
//EditorUtility.SetDirty(go);
//EditorSceneManager.MarkSceneDirty(go.scene);

销毁游戏对象或组件:

Undo.DestroyObjectImmediate (myGameObject);

更改变换组件的父子化:

Undo.SetTransformParent (myGameObject.transform, newTransformParent, "Set new parent");

标签:UnityEditor,transform,Undo,组件,go,myGameObject
From: https://www.cnblogs.com/kingBook/p/16627348.html

相关文章

  • MySQL事务MVCC、undolog和redolog
    MySql的MVCC多版本控制undolog:回滚日志(保证一致性)只有在ReadCommited和RepeatableRead隔离级别有用redolog:重写日志(保证持久性)示例讲解 ReadCommited隔离级别(4)se......
  • C#中通过Command模式实现Redo/Undo方案
    原文网址:https://www.jb51.net/article/252018.htm一个比较常见的改进用户体验的方案是用Redo/Undo来取代确认对话框,由于这个功能比较常用,本文简单的给了一个在C#中通过C......