[SOLVED] Camera clearColor unable to change

Hello,

I am trying to dynamically change the camera’s clearColor using something like this with no success:

this.entity.camera.clearColor.r = 0.8;

Do we need to use an update function or something similar?

try this

 var newcol = new pc.Color(0.8,0,0,0);
    this.entity.camera.clearColor = newcol;
1 Like

You need to set the entire color for the attribute change to be registered.

e.g.

var color = this.entity.camera.clearColor;
color.r = 0.8;
this.entity.camera.clearColor = color;
1 Like

Thank you both, now it works correctly.

Best regards,