20tab / UnrealEnginePython

Embed Python in Unreal Engine 4
MIT License
2.77k stars 754 forks source link

Spawn a pyactor in begin_play doesn't works fine. #883

Open Beanecessar opened 2 years ago

Beanecessar commented 2 years ago

I was follow the quick example and create a pyactor in runtime, then set the property just like the example SuperHero. But the python script of SuperHero doesn't run. Is there any additional works should I do? BTW, the example SuperHero has a mistake: Fvector -> FVector

davis-openai commented 1 month ago

Just in case anyone else runs into this, you have to specify the module and class during the spawn otherwise it is initialized without them:

world.actor_spawn(ue.find_class('PyActor'), PythonModule='mymodule', PythonClass='myclass')