diff options
Diffstat (limited to 'doc/classes/UndoRedo.xml')
-rw-r--r-- | doc/classes/UndoRedo.xml | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml index 6c151ef958..e43bceb941 100644 --- a/doc/classes/UndoRedo.xml +++ b/doc/classes/UndoRedo.xml @@ -27,11 +27,11 @@ undo_redo.commit_action() [/gdscript] [csharp] - public UndoRedo UndoRedo; + private UndoRedo _undoRedo; public override void _Ready() { - UndoRedo = GetUndoRedo(); // Method of EditorPlugin. + _undoRedo = GetUndoRedo(); // Method of EditorPlugin. } public void DoSomething() @@ -47,12 +47,12 @@ private void OnMyButtonPressed() { var node = GetNode<Node2D>("MyNode2D"); - UndoRedo.CreateAction("Move the node"); - UndoRedo.AddDoMethod(this, MethodName.DoSomething); - UndoRedo.AddUndoMethod(this, MethodName.UndoSomething); - UndoRedo.AddDoProperty(node, Node2D.PropertyName.Position, new Vector2(100, 100)); - UndoRedo.AddUndoProperty(node, Node2D.PropertyName.Position, node.Position); - UndoRedo.CommitAction(); + _undoRedo.CreateAction("Move the node"); + _undoRedo.AddDoMethod(new Callable(this, MethodName.DoSomething)); + _undoRedo.AddUndoMethod(new Callable(this, MethodName.UndoSomething)); + _undoRedo.AddDoProperty(node, "position", new Vector2(100, 100)); + _undoRedo.AddUndoProperty(node, "position", node.Position); + _undoRedo.CommitAction(); } [/csharp] [/codeblocks] |