Hi there, I have a parent object with 120 childs, the code is on the parent object and I need to make a switch to do stuff based on the child’s name, and it was working just fine but I don’t know what just happened I’m not getting it to work, (the tag on the player is working and assigned)…
private void OnTriggerStay(Collider car)
{
if (car.tag == "Player")
{
Transform[] children = GetComponentsInChildren<Transform>();
foreach (Transform child in children)
{
switch (child.name) //<-Also used this.name and was working fine
{
case "0":
player.transform.localPosition = new Vector2(-17, 9);
break;
case "1":
player.transform.localPosition = new Vector2(-16, 4);
break;
case "2":
player.transform.localPosition = dos;
break;
}
}…
Not getting an error it’s just not doing anything help please