I am looking for elements on a canvas (a textfield and a slider); so I can retrieve values and pass them to a function.
But so far I can't figure out how to access them; I can see the methods of the canvas itself, but I can't see the name of the elements that I did add on the canvas.
I have the canvas saved in a variable which is public; then I did place a slider and textfield, connected to text labels; but I can't seem to access neither the label nor the slider or textfield.
Canvas --
|___ Text
| |_____ InputField
|
|___ Text
|_____ Slider
I did plan to access to the text value in the input field doing something like canvas.text.inputfield.text, but this does not work, since I can't see the name of the text field when using dot notation. Same goes for the slider.
public Canvas mainmenu;
void Start() {
mainmenu = mainmenu.Getomponent
How do you actually access elements on a UI canvas, if you can't see them directly, even if they are parented to other elements?
No comments:
Post a Comment