i have this code to pause my game when my character collides but nothing happens
using UnityEngine;
using System.Collections;
public class Collision : MonoBehaviour
{
void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.tag == "rocket")
Destroy(gameObject);
Time.timeScale = 0f;
}
}
Hello.
You have syntax error…
you forget the Bracets for the if statement…
if (coll.gameObject.tag == "rocket")
{
Destroy(gameObject);
Time.timeScale = 0f;
}