HI,
In the method On CollisionEnter method do the following code
public void OnCollisionEnter(Collision collision)
{
StartCoroutine("PauseGame");
}
Your character should have rigidbody and a collider attached. Also if you have added tags ,then you need to check it in CollisionEnter Code as mentioned in the link suggested by Darsh2019. And this script should be added to the player .
↧