Accessing light components properties at runtime

Hi everyone,

I am aware that light components are a relatively recent additions, but I’ve hit a wall trying to modify their properties (like changing the color, adjusting intensity, or enabling/disabling them) at runtime from a .script file.
It seems like the properties available in the editor aren’t accessible via code. For example, when I try to use go.get() or go.set() on a Point Light like this:

local light_color = go.get("#point_light", "color")
go.set("#point_light", "intensity", 1.5)

I get the following error in the console:
'#point_light' does not have any property called 'color'
(and the exact same issue applies to other properties and other light types, like Ambient or Spot).

I’ve also checked the API reference but couldn’t find any specific documentation on runtime property access for these lights.

Am I missing a specific syntax to access these properties, a specific setup at the render pipeline level, or is runtime modification simply not yet supported?

Thanks in advance for any help!

Seem like a limitation of the new components. There is a github issue opened about that, seems they are working on it. I don’t know any other way other than writing the shaders and changing the rendering script yourself and then use vertex attributes to change the color.

2 Likes

Ah, okay, thank you! The GitHub issues page was actually the only place I hadn’t checked. I’m glad to see this has already been acknowledged by the team.

Since the project is 2D and I already have a lot of custom setup in my render script and shaders, I actually managed to find a simple workaround for my specific use case: I just rotate the light by 180 degrees on the X-axis via script to simulate an “off” state.

I figured I’d mention this approach for posterity, just in case the idea helps anyone else looking for a quick, temporary fix in the meantime!!

Thanks again!

2 Likes