Bitbybit Docs
    Preparing search index...

    Class BabylonGuiButton

    Push buttons with a text label. Subscribe to the button's pointer click event to run code when it is pressed; the label, colors and size can be changed after creation with the control methods.

    Index

    Constructors

    create

    • Creates a button with a text label, text color, background and font size; sizes are pixel strings or fractions of the parent, and a size left out is chosen by the engine.

      Parameters

      • inputs: CreateButtonDto

        The name, the label, the colors, the optional size and the font size

      Returns Button

      The button

      const button = bitbybit.babylon.gui.button.createSimpleButton({ name: "run", label: "Run", color: "black", background: "#f0cebb", width: "200px", height: "40px", fontSize: 24 });
      panel.addControl(button);
      button.onPointerClickObservable.add(() => { console.log("clicked"); });

    get

    • Reads the label currently shown on a button.

      Parameters

      Returns string

      The label text

    set

    • Changes the label shown on a button to the given text.

      Parameters

      Returns Button

      The same button