Skip to content

Keyboard ​

The default editor keyboard can be used at runtime.

Keyboard

js
// the keyboard will show in front of you
world.ui.keyboard.show();

// Override the onPress callback
world.ui.keyboard.onPress = (value) => {
  this.text.set(value);
  // value is equal to world.ui.keyboard.value
};

// Override function which is called when the enter key is pressed
world.ui.keyboard.enter = () => {
  this.saveData(world.ui.keyboard.value);
  world.ui.keyboard.hide();
};

// Clear the keyboard
world.ui.keyboard.reset();

Numpad ​

js
// The same for numpad
world.ui.numpad();