I am making a project where if player collides with any child of “Asteroids”, Application.Loadlevel(“lose”) needs to run. However, I cannot find a way to reference the child without getting an error.
I would appreciate any help!
Thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Let me try to understand: in the scene you have a GameObject called “Asteroids” that has asteroids as children (and all of them have their own collider). And you wanna know when you’ve collided with any them?
Instead of trying to check for their name why don’t you use tags?
In the inspector, below the gameobject name you can set the tag.