Skip to content

Commit d9679d6

Browse files
author
rdeioris
authored
Create Transactions_API.md
1 parent e06e3e0 commit d9679d6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/Transactions_API.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
The Trasaction API
2+
=
3+
4+
Transactions in Unreal Engine 4 are sequences of recorded editor commands that can be re-executed or reverted. It is the base of the undo/redo system of Unreal Engine 4.
5+
6+
If you want to check how transactions are managed, open select the "Edit->Undo History" menu item.
7+
8+
Managing transactions
9+
-
10+
11+
It is highly suggested to execute the commands with the "Undo History" panel opened:
12+
13+
```python
14+
from unreal_engine.classes import Actor, Character
15+
import unreal_engine as ue
16+
17+
world = ue.get_editor_world()
18+
19+
ue.begin_transaction('My first transaction')
20+
actor1 = world.actor_spawn(Actor)
21+
actor2 = world.actor_spawn(Actor)
22+
actor3 = world.actor_spawn(Actor)
23+
ue.end_transaction()
24+
25+
ue.begin_transaction('My second transaction')
26+
character1 = world.actor_spawn(Character)
27+
character2 = world.actor_spawn(Character)
28+
character3 = world.actor_spawn(Character)
29+
ue.end_transaction()
30+
31+
# undo the two transactions
32+
ue.editor_undo()
33+
ue.editor_undo()
34+
```

0 commit comments

Comments
 (0)