Dynamically creating buttons using Babylon GUI

How can I create set of buttons dynamically and get its information when a click is performed using babylon GUI.

Plenty of examples here The Babylon GUI | Babylon.js Documentation

What information do you want to get?

Can you give a specific example from your use case?

Ok, so I have 3 different models where the path of the models are stored in an array and 3 buttons,
On pressing Button1 -> Load a car 3d model //arr[0]
On pressing Button2 -> Load a boat 3d model //arr[1]
On pressing Button3 -> Load a tree 3d model. //arr[2]

I want to generate these buttons dynamically and make sure that each button has a unique data to (like id) to load the respective model by using that id.

give each button a name, 0, 1, 2 and use this to load respective model Button | Babylon.js Documentation

1 Like

Thanks !