Display one of prefab child

First of I am very new to Unity.

I have a script that places either prefab1 or prefab2 depending what keyboard button have been clicked.

Super simple:

prefab1       prefab2   
--child1      --child1
--child2      --child2
--child3      --child3

First of when I place the prefab it (of course) shows all models, that’s not what I want. I want to place/show only the first child.

Then I want to “age” the prefab. After some time it should change to prefab1.child2 then after some more time it should change to prefab1.child3 and so on.

I don’t want to hardcode children and such, that is where I encounter problems.

My question is:

Can I place a prefabs child then change that later?
something like this pseudocode:

if buttonClicked = "1"
    activePrefab = prefab1     

if buttonClicked = "2"
    activePrefab = prefab2

buttonClicked = "space"
   child = activePrefab.transform.GetChild(0).gameObject
   Instantiate (child , player.position, player.rotation)

age = age + (Time.time)

if age > 5
    newChild = activePrefab.transform.GetChild(1).gameObject
    Instantiate (newChild, child.position, child.rotation)

Does anyone have any ideas, know of an old thread, or seen a video somewhere about it?

Regards,
Jerakin

I would suggest you write an ‘aging’ script and put it on the parent object.

On Awake() it hides all models, then as time goes by, the model is swapped according to your needs.