Delete actor in UnrealScript from Python

346 views Asked by At

I try to delete some actors in the scene using python but keep getting errors, I don't know how to modify my code.

The error is generated in the second sentence:

get_editor_subsystem() takes exactly 1 argument (0 given)

Here is my code:

path=“Test.thisIsTest”
unrealSystem=unreal.get_editor_subsystem()
delete_actor=unrealSystem.get_actor_reference(path)
unreal.EditorActorSubsystem.destroy_actor(delete_actor)
2

There are 2 answers

0
Gil de Góes On

You need to specify the Subsystem type in line 2:

unreal.get_editor_subsystem(unreal.EditorActorSubsystem)

I hope it helps.

0
SjoCi On

I would suggest another way:

editorActorSubsys = unreal.EditorActorSubsystem()
editorActorSubsys.destroy_actor(delete_actor)