Unity3D UI Button: change button text

Trabla: Unity3D UI Button: change button text

Solving:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class MyChangeButtonTextExample: MonoBehavior
{

// Public reference to button, where we need change text
public Button myButton;

void Start()
{
      // Changing Button text in Text component
      myButton.GetComponentInChildren<UnityEngine.UI.Text>().text = "Trololo";
}

}
// MyScript

No comments:

Post a Comment