Add limit to the input feild

i want that in the input feild the text limit should be 20 and the input feild shoild not take more than 20
pg https://playground.babylonjs.com/#SI13I2#17

You can use the observables for that:

namefeild.onTextChangedObservable.add(() => {
            if(namefeild && namefeild.text.length > 20) {
                namefeild.text = namefeild.text.substring(0, 20);
            }
        })

Bag configrator | Babylon.js Playground (babylonjs.com)

1 Like