I want to find a child apart of a transform and then go one above or below it. I hope that explains it, its kind of difficult to explain but here’s the code:
if (Input.GetKeyDown(KeyCode.W))
{
foreach (Transform child in hook)
{
if (child.name == currentSegment.gameObject.name)
{
//what I want is getting the child I found and then going to the one above it
currentSegment = child++;
}
}
}
else if (Input.GetKeyDown(KeyCode.S))
{
foreach (Transform child in hook)
{
if (child.name == currentSegment.gameObject.name)
{
currentSegment = child--;
}
}
}