I’m having issues selecting a Sphere Collider using a tag on the GameObject whose collider I want to use. I’m getting the following error:
“error CS0266: Cannot implicitly convert type UnityEngine.Collider' to UnityEngine.SphereCollider’. An explicit conversion exists (are you missing a cast?)”
Ideally what I want to do is select the SphereCollider in a scene of the object tagged as Planet. Is there a better way to do this?
private SphereCollider planet; //collider for planet
void Start () {
GameObject sc = GameObject.FindGameObjectWithTag("Planet");
planet = sc.collider;
}