How do you spawn characters using Python?

Hi,

I’m testing out the Python API for Unreal Engine and it looks very promising. Problem is the lack of examples is making it a bit difficult to move things at a steady speed.

So, I created a Character BP called James. The JamesBP has the skeletal mesh, animation bp, etc all setup.

How do I spawn it in the Level using Python?

It’s probably something like below but I’m not sure.



actor_to_spawn = wtf?
unreal.EditorLevelLibrary().spawn_actor_from_class(actor_to_spawn.static_class(), [0, 0, 124])


Ok, I found the solution. More code examples would be really helpful though.



actor_to_spawn = unreal.load_asset("/Game/Actors/JamesBP")
unreal.EditorLevelLibrary().spawn_actor_from_object(actor_to_spawn, [0, 0, 124])


1 Like