Download

Python - set_editor_property Directional Light

Is it possible in Python to use “set_editor_property” on a Directional Light?

I’ve tried:

.set_editor_property(“Intensity”, 100)

But this doesn’t work. Nor does removing the quotes. Any suggestions?

Looks like the intensity is underneath the lightComponent not the main actor itself.


sun_location = unreal.Vector(0.0, 0.0, 500.0)
lightObj = unreal.EditorLevelLibrary.spawn_actor_from_class(unreal.DirectionalLight, sun_location, rotation=[0,0,0])
lightObj.set_actor_label("sun")
#find component
lightComp = lightObj.light_component
lightComp.set_editor_property("intensity",5.0)

#check to see if it actually did something
print lightComp.get_editor_property("intensity")

I can’t resolve


lightComp = lightObj.light_component

Are you receiving an error on this line?

I ran my example code without issues. Maybe remove my “#” comments? Or what code are you running?
I’m running 4.22.x