How to access a label from other script?

Hi,
i have a UICanvas with a Child ( label ).
How can i reference the label to a script that sits in the UICanvas ?

i only want change the labeltext.

The way the UI system works right now is the there is a UIControl actor and a control type on that actor. For example to get a control type of label, you need to get a reference to the UIControl holding that label. Once you have a reference you can do something like this var label = _uiControlReference.Get<Label>(). That will give you a reference to the label on the UIControl. Then you can change the text variable. You can find an example in the docs https://docs.flaxengine.com/manual/ui/tutorials/create-ui.html.

2 Likes

Thank you !

it works :slight_smile: