Textbox attribute

Hey,

It is possible to have “string” attributes to script (eg. so you can input strings to the script in the editor), but by default this is a small one line input field meant for just a single word or very short sentence.

Does anyone know if it’s possible to make this input field behave as a larger text box? (Such as seen in the UI “Element” type shown below)

@Leonidas do you know if this is a feature?
Otherwise I think I’ll make a feature request about it :slight_smile:

Hi! No, as far as I know we only have control over type for script attributes, not how it will be displayed. Definitely make a feature request, that would be useful to have.

As for the attribute itself, you can add string attributes:

MyScript.attributes.add('myString', { type: 'string' });

You can find other supported types in the API docs:

Yeah, I know… It’s just a bit inconvenient if you wanna input longer texts.

I made a feature request here: Textbox attribute option · Issue #1097 · playcanvas/editor · GitHub

1 Like