How to name and disable children and grandchildren?

I have a Spycar from Synty. It has a missile rack with 10 missiles that pop out of the roof. I want to use these for show and have each one get disabled and an AI missile instantiated on top of it everytime one is fired. (The rack is a child and the missiles are grandchildren to the Playercar, but I can change them all to children if I have to).

I need to first name them in an array (roofMissiles[0] = “SM_Veh_SpyCar_RoofMissile_06”
Once I have the GameObjects, I think I can disable them like this:
roofMissiles[indexPointer].SetActive(false)

What’s the code to get a hold of them? Please.

It took all day, but I figured it out.
first I created:
public GameObject[] roofMissiles;
Unity will ask how big the array is. I put 10 and 10 slots appeared, then I dragged and dropped each missile that came with the model in the slots and now I could shut off the children at will.
roofMissiles[indexPointer].SetActive(false);

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms