☑ Script attribute resetting

I have an attribute on a script, and that script goes on many objects. Whenever I set the attribute to something other than it’s default value, it gets reset every time I close the project and open it again.

HotspotPlane.attributes.add('depthTest', { type: 'boolean', text: 'Depth test', default: 'false', description: 'Whether not to ignore the depth channel and make the hotspot Xray.' });

Even though it’s set to be false by default, It’s always true on all instances when I open the project editor.

Please advice

I’ve looked at you problem. You have default value a string, not boolean. This screws up you attribute. To fix it, comment attribute, parse script, then fix default value to right type, and then uncomment attribute and parse again.

Ideally there shall be sanity check of type of default value.

1 Like

Thanks again Max, that was it!

I changed it to this and now it’s working like a charm.

HotspotPlane.attributes.add('depthTest', { type: 'boolean', text: 'Depth test', default: false, description: 'Whether not to ignore the depth channel and make the hotspot Xray.' });

Have a nice weekend!

I’ve added extra check in Editor to ignore defaults if they are not the right type in most cases.
Will be deployed next week.

Have a good one too :slight_smile: