Dynamically creating lights causes an error. Bug or limitation?

I am trying to create an effect for my player to throw a flare to light up an area, triggered by a key press. To do this I am creating a Flare object at my player location and then creating a Lights_Flare lighting object at the same location.

I would expect the Flare object to appear and for the Lights_Flare object to be placed at the same location on the Lighting layer. However, this is causing a TypeError: Cannot read properties of undefined (reading 'vertex') error.

I’ve done a lot of playing around and it seems any kind of dynamic trigger causes the problem. I’ve tried:

  • Press/Release of a key
  • A certain animation is played
  • A variable condition is true

I’m using similar conditions to create lights on objects that exist at the start of the scene without any problems. Indeed, if I place a Flare object in the scene in the designer and then dynamically create the Lights_Flare object at the start of the scene it works fine. It is literally only when creating a light during the scene after loading that it fails.

Any thoughts or is dynamically creating lights just not supported?

That is a bug caused by creating lights on specific locations, the devs were aware of that at some point.

Looks like I’m moving flares to the back of the task list then. I saw some reports of similar behaviour a couple of years ago but obviously this hasn’t been resolved since.