Search Unity

Changing Unity 5 button text on click.

Discussion in 'Scripting' started by dijital, Jun 29, 2015.

  1. dijital

    dijital

    Joined:
    Apr 28, 2010
    Posts:
    232
    Hi all,

    Im using the new button system in unity 5, I would like the text to change on the button when I click it (this is a for a quality settings buttin, High, Medium, Low)

    I cant work out hoe to do it, does anybody have any ideas?

    Thanks!
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    you'll need to make a function which is hooked up to the OnClick() event for the button in the inspector.

    best approach would be to update the setting you want to change and have the function "refresh" the text for the button.
    note the text for a button is on a child gameobject

    https://unity3d.com/learn/tutorials/modules/beginner/ui/ui-text
     
  3. dijital

    dijital

    Joined:
    Apr 28, 2010
    Posts:
    232
    Thanks for the info