[SOLVED] Why these codes can't change a light's intensity and range?

Lantern.prototype.onTriggerEnter = function() {    
    this.light.enabled = true;
    this.light.intensity += 0.5;
    this.light.range += 1;
    // console.log(this.light.intensity);

Only this.light.enabled = true; worked.


Where do you define this.light? If this is an entity, then you should be doing the following to access the light component:

this.light.light.intensity += 0.5;

Thanks, this problem has been solved.

1 Like