@@ -888,7 +888,7 @@ class Ball:
888888
889889Now we create (at runtime !!!) a whole new PyActor:
890890
891- ``` py
891+ ``` python
892892class SuperHero :
893893 def begin_play (self ):
894894 # spawn a new PyActor
@@ -906,6 +906,47 @@ class SuperHero:
906906 pass
907907```
908908
909+ Spawning Notes
910+ --------------
911+
912+ Remember that only Actors can be spawned in a world, and that even the editor is a valid world:
913+
914+ ``` python
915+ import unreal_engine as ue
916+ from unreal_engine.classes import Actor, Character
917+ from unreal_engine import FVector, FRotator
918+
919+ world = ue.get_editor_world()
920+ actor000 = world.actor_spawn(Actor, FVector(0 , 0 , 0 ), FRotator(0 , 0 , 0 ))
921+ character000 = world.actor_spawn(Character, FVector(100 , 100 , 100 ), FRotator(0 , 0 , 0 ))
922+ ```
923+
924+ Remember that the Blueprint asset is not a valid actor by itself, you need to get the class generated by the blueprint:
925+
926+ ``` python
927+ import unreal_engine as ue
928+ from unreal_engine.classes import Blueprint
929+ from unreal_engine import FVector, FRotator
930+
931+ world = ue.get_editor_world()
932+
933+ blueprint = ue.load_object(Blueprint, ' /Game/TestBall.TestBall' )
934+ actor000 = world.actor_spawn(blueprint.GeneratedClass, FVector(0 , 0 , 0 ), FRotator(0 , 0 , 0 ))
935+ ```
936+
937+ otherwise you can directly reference the BlueprintGeneratedClass
938+
939+ ``` python
940+ import unreal_engine as ue
941+ from unreal_engine.classes import BlueprintGeneratedClass
942+ from unreal_engine import FVector, FRotator
943+
944+ world = ue.get_editor_world()
945+
946+ blueprint_actor = ue.load_object(BlueprintGeneratedClass, ' /Game/TestBall.TestBall_C' )
947+ actor000 = world.actor_spawn(blueprint_actor, FVector(0 , 0 , 0 ), FRotator(0 , 0 , 0 ))
948+ ```
949+
909950Integration with PyQT
910951---------------------
911952
0 commit comments