I am only able to access only first child( there are 5 more) , i want to access all 6 at once . I am talking about this line ChangeColor ChangeColor1 = thePlayer.GetComponentInChildren();
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class onClick1 : MonoBehaviour {
public Text ScoreText;
private int Count = 10;
private int wrongAnswer = -5;
public bool hello;
public void SayHello( bool hello = false ) {
if (GetComponent<Image> ().color == GameObject.FindGameObjectWithTag ("DisplayButton").GetComponent<Image> ().color) {
GameObject thePlayer = GameObject.FindGameObjectWithTag("GameController");
DisplayColor displayColor = thePlayer.GetComponentInChildren<DisplayColor>();
ChangeColor ChangeColor1 = thePlayer.GetComponentInChildren<ChangeColor>();
hello = true;
displayColor.changeColor();
ChangeColor1.ColorME();
ScoreText.text = "SCORE: " + Count;
} else if (GetComponent<Image> ().color != GameObject.FindGameObjectWithTag ("DisplayButton").GetComponent<Image> ().color) {
hello = false;
ScoreText.text = "SCORE: " + wrongAnswer;
}
}
}