Duplicated attributes initialization

Hey team! If script is created by create method width attributes then attributes immediately initialized setting ScriptType’s __attributesRaw to null. Second __initializeAttributes goes once script is enabled forcing all attributes to default values.

entity.script.create('playerController', {
    attributes: {
        speed: 4
    }
});

// entity.script.playerController.speed is 4

app.root.addChild(entity);

// entity.script.playerController.speed is default

upd:
“preloading: true” prevents attributes loss

entity.script.create('playerController', {
    preloading: true,
    attributes: {
        speed: 4
    }
});
1 Like