(Solved)Coming from Unity How do I access components of Actors?

For example I created a TextBox UIControl so a user can type into it during runtime. How do I access the text in the TextBox so I can put the data into a string variable at runtime?

Unity uses GetChildren<> to access components of GameObjects. I saw Flax has Actor.GetChild. But that seems to be only for finding another Actor that is a child of the Actor I’m accessing in the code NOT for accessing components of an Actor. How would I access the TextBox component?

I’ve looked through the API and I can’t find any information regarding accessing components of Actors with code.

Figured it out. UIControl is not an Actor. The UIControl class has a way to access the text in the Text Box. Actor has a way to access its components as well which is similar to how Unity accesses components on GameObjects.

For UIControl use Get<>
For Actors use GetChild<>

1 Like