BJS Error after disabling point light

Hello friends, for the first time I have encountered that big fat red error in console that doesnt make any sense to me (full of strange things that I dont understand and honestly admire those who do).

That error happens when I am disabling point lights.

My lights currently are

1 spot light as “sun” (enabled only during day)
1 point light as “character´s torch” (enabled only during night)
2 point lights as campfires (enabled only during night)

When dawn comes and campfire lights are shut down setEnabled(false), then strange error occurs.
Interesting fact is that when I remove one campfire, then everything is ok, problem is only when I have more than one.

I would like to somehow debug it myself, but this error is completely unreadable for me :frowning:

As additional info - all 3 point lights has “manualy managed” includedOnlyMeshes list to only enlight meshes that are close enough (but seemignly this error happens even if I remove that management).

If I remove that character´s own pointlight, error still happens.

Does someone have idea what could be possibly wrong ?

Link is here http://darkenlight.net/babylon

Just wait few seconds for dawn of a new day and error will show in console (also sunlight will be corrupted).

Thanx for some ideas in advance, this is tough nut to crack for me :-/

EDIT: Everyting is fine when I let these lights “enabled” but I think that it is bad idea to have more lights active than is neccessary. When character will move around, lights will come and go, I cannot keep all of them active forever. Dispose() produces the same error as disabling (which is kinda expectable).

After hundred of test attempts I finally isolated root cause, I am not sure if it is bug or my fault, but apparently that “spotlight” caused it as it is as well “shadowCaster”.

I was able to reproduce that error on playground https://www.babylonjs-playground.com/#20OAV9#452

There are bunch of grounds enlighted by 3 pointlights and 1 spotlight, then there is a sphere which shall give shadow to that grounds (spotlight is shadowcaster). After 3 seconds these 3 pointlights are disabled and there we go - error here.

Wonderful (for the repro). I’ll have a look today

Hope that this playground will help, it occurs at pretty specific circumstances that I won´t be probably able to describe only by words :slight_smile:

Thanx for your reaction mister :wink: Hope that you will not feel as confused as me reading that error message :slight_smile:

Ok it was a bug!!! good catch!
I’ll have it fixed in a couple of minutes and then I will push a nightly

Good to know and thanx for fix :wink: You are doing great job !! (all of you who participate on development of babylon.js)

1 Like

Yes, first of all thanks for the fix and I am also participating in the development of babylon.js