Skip to content

Commit 47d5152

Browse files
author
Roberto De Ioris
authored
Update Level_API.md
1 parent ebf83da commit 47d5152

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

docs/Level_API.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,33 @@ Let's try to clarify things wth another example (read comments carefully):
2727

2828

2929
```python
30-
from unreal_engine.classes import WorldFactory
30+
import unreal_engine as ue
31+
from unreal_engine.classes import WorldFactory, Actor, PlayerStart
3132

3233
factory = WorldFactory()
3334

3435
# create a world (it will be the main one, the one you load into the editor by double clicking it)
35-
main_world = factory.factory_create_new('/Game/Maps/MainWorld001')
36+
main_world = factory.factory_create_new('/Game/MapsTest/MainWorld001')
37+
# spawn actors in the world
38+
actor0 = main_world.actor_spawn(PlayerStart)
3639

3740
# create another world
38-
child_world1 = factory.factory_create_new('/Game/Maps/ChildWorld001')
41+
child_world1 = factory.factory_create_new('/Game/MapsTest/ChildWorld001')
42+
# spawn actors in the world
43+
actor1 = child_world1.actor_spawn(Actor)
44+
actor2 = child_world1.actor_spawn(Actor)
45+
actor3 = child_world1.actor_spawn(Actor)
3946

4047
# create another world
41-
child_world2 = factory.factory_create_new('/Game/Maps/ChildWorld002')
48+
child_world2 = factory.factory_create_new('/Game/MapsTest/ChildWorld002')
49+
# spawn actors in the world
50+
actor4 = child_world2.actor_spawn(Actor)
4251

4352
# now the important part, each UWorld, has a ULevel mapped to it (the PersistentLevel):
44-
4553
main_level = main_world.PersistentLevel
4654
child_level1 = child_world1.PersistentLevel
4755
child_level2 = child_world2.PersistentLevel
4856

57+
# open main world in the editor
58+
ue.open_editor_for_asset(main_world)
4959
```

0 commit comments

Comments
 (0)