☑ How do script attributes work? Script attribute remains undefined

Maybe I can reach a larger public of programmers here. This seems to be a hard nut to crack.
Can anyone reproduce this with atlas being defined?

Thanks

I will have a close look today.

Forum is a bit more popular place for asking questions :slight_smile:

Thank you :stuck_out_tongue:

I’ve investigated the problem, and does seems like when script is created without attributes object passed, it would lead to not initialising attributes. There was a reason for it, to prevent too early or multiple init of scripts.
So I’ve added force init when script is getting enabled, that way it will initialise attributes on enable, even if no custom attributes were provided into constructor.

Here is a commit: https://github.com/playcanvas/engine/commit/b6ada729eef3afc129f7e2b2369a789e5b5b3181

Bear in mind that this wont be available as stable until deployed.
And for the future, if this is engine-only bug, then worth creating a Issue here: https://github.com/playcanvas/engine/issues
If it is Editor and other PlayCanvas stuff related, forum is probably the best place to ask. ‘answers’ website will be going soon.

1 Like

Thanks for your time and for the patch Max!
I will keep in mind to report these kind of things on github in the future.

1 Like

Thank you for finding the bug! :slight_smile:

hey @max @ozette
this is an old post but what was the conclusion there and how can I make sure I am using some sort of stable and well-predicted method with my attributes?

thanks!

1 Like