Creating a property with multiple variant options

Hi there, I am trying to add functionality to my plugin that lets me add a property with multiple Variant options, however, when I try to use the addComponentProperty method, it seems to only accept a default value and when adding other values, I believe that their type must be an ‘INSTANCE_SWAP’, is there a way around this? and please correct me if I am wrong

This function supports properties with type 'BOOLEAN' , 'TEXT' , 'INSTANCE_SWAP' or 'VARIANT' .

Yes, I have used it, but here is the thing, I am trying to create a VARIANT property that has Three values, the property is called State and its values are [“Active”, “Inactive”, “Disabled”], but the addComponentProperty lets me only add one default value (“Active”) and I can’t add the other variant values/options.

I believe you need to call the addComponentProperty method on the parent ComponentSetNode, not on a regular ComponentNode. I could be wrong though, as I don’t have much experience with this.

Yes I did that, and you are right, you can’t call the addComponentProperty method on ComponentNode, but still, the problem exists, I can’t add more than one variant values/options.

But thanks for the help anyway!

As a workaround, you can create a new component node or duplicate an existing one and append it to children of the component set node. That would create a new variant, you’ll just need to set the right parameters for it. But I still think it should be possible to use the function you want to use, I just don’t have time to test it now to give you a specific example.

1 Like
1 Like

Thank you so much, this worked fine :pray: