[Suggestion] Conditional script attributes

Hello PlayCanvas team,

I think it would be great to have some sort of conditional attribute creation / update.
Here is the mockup code:

pc.script.attribute ('type', 'enumeration', 0,
{
    displayName: 'Type',
    enumerations:
    [
        {name: 'Default', value: 0},
        {name: 'Jumppad', value: 1},
        {name: 'Teleport', value: 2}
    ]
});

pc.script.onAttributeChange ('type', function (value)
{
    if (value === 0)
    {
        // draw nothing
    }

    if (value === 1)
    {
        pc.script.attribute ('strength', 'number', 10);
    }

    if (value === 2)
    {
        pc.script.attribute ('radius', 'number', 5);
    }
});

It would allow for using one generic script on multiple occasions without dealing with extending and polymorphism.

Thanks!

@Dinkelborg Yeah, the onAttributeChange() in this mockup is not the same as in PlayCanvas API. This one would be the part of pc.script and would be executed in cloud IDE just as pc.script.attribute does.