How to get a 3d gui button by its name?

How to get a 3d gui button by its name? I’ve tried use Scene.GetControlByName, but it can not find the button.

I found a workaround, I just traverse the rootContainer’s children and do the check myself

Hey,
Could you tell something more about your case? When exactly do you want to get this button by its name? After clicking it?
It would be great if you could share the PG showing what you want to achieve.

I set the button name to record info related to the button. I use its name before clicking it.

Without the actual code it is difficult to understand what is going on.
It sounds like you could do something like

const buttons = []; // array of buttons
const buttonByName = buttons.find(btn => btn.name === 'name');
1 Like