Im trying to make the "Game Over" part of my game and i ran into this error, and i have no idea how to fix this. Can someone help me out?
Here's the code
public GameObject Wreck;
public GameObject ISLWreck;
private game_controller gamecontroller;
void Start()
{
GameObject gamecontrollerobj = GameObject.FindWithTag("GameController");
if (gamecontrollerobj != null)
{
gamecontroller = gamecontrollerobj.GetComponent();
}
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "Boundary")
{
return;
}
if (other.tag == "Background")
{
return;
}
if (other.tag == "Hazard")
{
Destroy(other.gameObject);
Destroy(gameObject);
Instantiate(ISLWreck, transform.position, transform.rotation);
gamecontroller.Gameover();
}
else
{
Destroy(other.gameObject);
Destroy(gameObject);
Instantiate(Wreck, transform.position, new Quaternion(-90, 45, 45, 0));
gamecontroller.Gameover();
}
}
↧