[SOLVED] I can't seem to get onAttributeChanged to fire

I’m using the onAttributeChanged function in my script and it doesn’t seem to ever fire. I have it in multiple scripts and it doesn’t fire in any of them. It just never seems to get called so I assume I’m doing something wrong. I also want to know how the values are changing from the launcher so I’m updating them in the browser.

At the top.

pc.script.attribute('cameraBoomLength', 'number', 30, {
    displayName: "Camera Boom Length"

In the initialize function of my script I have.

this.on('set', this.onAttributeChanged, this);

And in onAttributeChanged

    onAttributeChanged: function (name, oldValue, newValue)
        console.log('tiCameraBoom: onAttributeChanged called.');
        if (name === 'cameraBoomLength')
                console.log("name is: " + name);
                var tLoc = this.tiCamera.getLocalPosition();
                this.tiCamera.setLocalPosition(tLoc.x, newValue, tLoc.z);

All the entities are set up correctly, if I move the code to a function I call myself it works find. I just thought this automatically fired off when editor attributes were changed. I’m just wondering if I’m doing something wrong. Any help would be greatly appreciated.


This seems like a bug. We’ll have a look and get back to you.

Thanks and sorry for the inconvenience.

No worries, thanks for getting back to me.

Yep, I’ve noticed that too, though I’ve been trying to get it work directly as a function on script prototype, without attaching to ‘set’ event. Couldn’t make it work.

This should now be fixed guys, just refresh your Editor.