eldridge
eldridge

Reputation: 11

Delete actor in UnrealScript from Python

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)

Upvotes: 1

Views: 629

Answers (2)

SjoCi
SjoCi

Reputation: 121

I would suggest another way:

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

Upvotes: 0

Gil de Góes
Gil de Góes

Reputation: 11

You need to specify the Subsystem type in line 2:

unreal.get_editor_subsystem(unreal.EditorActorSubsystem)

I hope it helps.

Upvotes: 1

Related Questions