[Lua][FogBug] Can't ToggleLight for Point Light (version 1.23.1.0)

Hello everyone,
I’m new to Amazon Lumberyard. Just trying to perform a simple stuff like ToggleLight for Point light, but facing a problem.

Here’s the console output:
[Error] (Script) - lightmanager.lua:44: attempt to call field ‘ToggleLight’ (a nil value)

I also tried to use a similar script from the samples (\dev\SamplesProject\Scripts\Components) called LightFlicker, and faced the same problem.

The line causing error in my (lightmanager.lua) script:
LightComponentRequestBus.Event.ToggleLight(self.entityId)

The following screenshot showing how the light entity looks in Entity Inspector:
Entity

However, I can access the Transform component form this LightManager script:
Debug.Log(TransformBus.Event.GetLocalTranslation(self.entityId))
returns (x=302.0000000,y=513.0000000,z=65.0000000)

Would appreciate for any info. Thanks.

1 Like

hi! try to use

		Light.Event.SetVisible(self.entityId, true);
1 Like

Hi, your solution works fine, thank you!