I have a Slider GameObject with a GUIText child.
I am writing a C# script that changes the text component in the GUIText, but am getting the error ***UnityEngine.GUIText does not contain a definition for ‘text’ of type UnityEngine.GUIText ***
public Slider timeSlider;
int i = 5;
timeSlider.GetComponentsInChildren<GUIText>().text = 'Some Text' + i;
You used GetComponentsInChildren while you probably want to use GetComponentInChildren. Note the “s”!
GetComponentsInChildren returns an array, so it returns all components of the given type. GetComponentInChildren returns the first component of the given type it can find.
Yeah... I read about it too... But seems this doesn't apply to var.Lenght (array) var.Count (List).
– Barruchi