Script attributes not stable in Editor

as you see, script attributes isn’t match and will cause undefined. it happens on firefox and ie edge

hey fxcarl,
I noticed a similar thing during the weekend, but didn’t got the time to correctly debug it.

I think this happens, if you define certain attributes in a wrong order. Try to set the default value as last object between the {} brackets. That fixed the problem for me.


That shouldn’t really matter as the options are just a JSON object. We will have a look at the problem.

Can you please explain steps you are taking, to get to that state?
Are those three screenshots a specific state, or they are made in different times? How you get from 2 to 3 image?

I can repeat them 100% in edge

when after open the editor, inspector looks like state 3 (right)

so I reparsed code, and every thing looks good like state 1 (left)

then I click the entity in hierarchy tree, inspector looks like state 2 (middle)

If there are any exceptions in dev tools?

oh, let me see, here it is ~

No err at first.

when at state 3 and click “parse” :

click another entity and come back, inspector looks like state 2, console shows

1 Like

That is useful, I will have a look.

Could you please share at least attributes definition code?

okay ~

var PhysicalDroneDrive = pc.createScript('physicalDroneDrive');

    type: 'number',
    title: 'Max Thrust',
    placeholder: 'N',
    default: 50

    type: 'number',
    title: 'Thrust Changing Rate',
    placeholder: 'N/s',
    default: 50

    type: 'number',
    title: 'Expect Height',
    placeholder: 'm',
    defualt: 50

    type: 'vec2',
    title: 'Horizontal Velocity',
    defualt : pc.Vec2.ZERO

    type: 'vec2',
    title: 'Heading',
    defualt : pc.Vec2.ZERO

    type: 'boolean',
    title: 'Heading Velocity',
    defualt : true
1 Like

Trying to replicate it locally but with no success.

Do you change script between parsings? Or you don’t change script just hit “parse”?
If you do change script, could you share attributes from what and to what you change them?

Please provide as much details as possible to allow me to understand exactly steps you are making.

I always got stage 3 after open editor. It need not do anything, just hit parse, the script detail will change to stage 1

I created a new script and paste codes to new script. everything ok now

the problem is on specific asset id not on every script

I cant replicate all my coding process, attributes often add / remove / edit in scripting,