In Unity, I created the Button GUI element; through the visual editor I assigned the text "Hello" . Actually the question is: How to get to the button element in the code and get its Text values?

    1 answer 1

    Method to get button object

     public Button GetButton(string caption) { var go = GameObject.Find(caption); var button = go.GetComponent<Button>(); return button; } 

    The button text is in the text property.