At about 30 minutes into the Infinite Runner Live Training, Mike used a quad to make a 2d Collider to pause the game. I copied the code word for word I’m pretty sure, but the game still doesn’t pause. I have been looking over my project for about half an hour now trying to figure out what went wrong, but couldn’t find anything. I would appreciate if anyone could tell me what I am doing wrong. Thanks and here’s my code.
using UnityEngine;
using System.Collections;
public class DestroyerScript : MonoBehaviour {
void OnTriggerEnter2d(Collider2D other)
{
if(other.tag == "Player")
{
Debug.Break ();
return;
}
if(other.gameObject.transform.parent)
{
Destroy (other.gameObject.transform.parent.gameObject);
}
else
{
Destroy(other.gameObject);
}
}
}