Skip to content

Commit 743a4f1

Browse files
committed
Adds doc for managing properties transaction
1 parent ac19f6a commit 743a4f1

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎docs/Transactions_API.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,38 @@ ue.editor_undo()
3939
ue.editor_redo()
4040
```
4141

42+
43+
Managing transactions with property modification
44+
-
45+
46+
```python
47+
48+
import unreal_engine as ue
49+
from unreal_engine import FVector
50+
from unreal_engine.classes import StaticMesh, StaticMeshActor
51+
52+
#Create procedurally a Cone in the Editor
53+
world = ue.get_editor_world()
54+
cone2 = world.actor_spawn(StaticMeshActor)
55+
cone2.StaticMeshComponent.StaticMesh = ue.load_object(StaticMesh, '/Engine/BasicShapes/Cone')
56+
57+
#Start Transaction
58+
ue.begin_transaction("Move Up +15")
59+
position = cone2.get_actor_location()
60+
position.y += 15
61+
62+
#Call modify to track property changes before setting the position
63+
cone2.modify()
64+
cone2.set_actor_location(position)
65+
ue.end_transaction()
66+
67+
#Undo "Move Up +15"
68+
##ue.editor_undo()
69+
```
70+
71+
72+
73+
4274
Functions
4375
-
4476

0 commit comments

Comments
 (0)