- Home /
Question by
$$anonymous$$ · Apr 04, 2020 at 05:28 AM ·
transformparentchildhierarchy
find next(not necessarily immediate next) child of another parent in hierarchy with tag "checkpoint"?
there are 10 gameobjects in hierarchy
4 of them has a child with tag "checkpoint" and those child have box collider with trigger turned true
there is an empty gameobject called nextCheckpoint
when player ontriggerenters first child
nextCheckpoint's transform = next child with tag "checkpoint"s transform
if there is no next child in hierarchy with "checkpoint" tag,
nextCheckpoint's transform = first child with tag "checkpoint"s transform
hope im clear enough
i want to find next gameobject in hierarchy, not necessarily immediate next, parent or child, with a specific tag
Comment
Best Answer
Answer by $$anonymous$$ · Apr 04, 2020 at 09:56 AM
ok figured it out
GameObject[] pupu = GameObject.FindGameObjectsWithTag("Checkpoint");
now you have all the checkpoints by their index value, now you can do all the stuff to them
pupu[1].dostuff;