I have a series of dynamically created objects (coming from a prefab) and I need to change the value of a child ui text element on each one just after they are instantiated.
Here is my current code:
Transform button = Instantiate(ButtonPrefab); Text ButtonText = button.GetComponentInChildren (Text); ButtonText.text = "this be some text!";
This code is giving the error ‘UnityEngine.UI.Text’ is a ‘type’ but a ‘variable’ was expected. What am I doing wrong?