My Slider GameObject has a GUIText child. I am writing a C# script that should change the text component in the GUIText, but instead of this I am getting:
error CS1061: Type UnityEngine.GUIText[]' does not contain a definition for text' and no extension method text' of type UnityEngine.GUIText[]' could be found (are you missing a using directive or an assembly reference?)
public Slider timeSlider; int i = 5; timeSlider.GetComponentsInChildren<GUIText>().text = 'Some Text' + i; //timeSlider.transform.GetComponentsInChildren<GUIText>().text = 'Some Text' + i; // doesn't work either From the documentation I understand that GUIText should have a 'text' variable - Would anyone know why ().text is invalid?
Thank you!
How the hierachy is:
