i am trying to access child of child which is a clone itself.
tried every possible way but in vain.
i have tried i adding code also here i have commented the problem infront of each line .
public GameObject test;
private Transform[] target;
public Transform [] checkpoints;
public GameObject[] instantiate_cars;
public int get_pref_int_car;
public int get_pref_int_color;
// Use this for initialization
void Awake()
{
get_pref_int_color = PlayerPrefs.GetInt ("colorcar");
get_pref_int_car = PlayerPrefs.GetInt ("CarSelected");
GameObject childObject = Instantiate (instantiate_cars [get_pref_int_car]) as GameObject;
childObject.tag = "myplayer";
Debug.Log(""+childObject.transform.FindChild ("Chassis Joint(Clone)").transform.GetChild (0).name); // tried this null refrence
//childObject.transform.GetChild(8).transform.GetChild(0).transform.GetChild(0).GetComponent<MeshRenderer>().material.mainTextureOffset = ColorPicker.coloroffsets_pass[get_pref_int_color]; // out of ondex
target = GameObject.FindWithTag ("myplayer").GetComponent<CarCheckpoint> ().checkPointArray;
target [0] = checkpoints [0];
target [1] = checkpoints [1];
}
void Start () {
Debug.Log ("" + GameObject.FindWithTag ("myplayer").transform.GetChild (7).name); // null refrence
Debug.Log ("" + GameObject.FindWithTag ("myplayer").transform.FindChild ("Chassis Joint(Clone)").name); // null refrence
}
Any suggestions ,