CS0118, DestroyByContact.Game controller' is a
field’ but a type' was expected and CS10621, Type
object’ does not contain a definition for GameOver' and no extension method
GameOver’ of type `object’ could be found (are you missing a using directive or an assembly reference?). Here is my script
{
public GameObject explosion;
public GameObject playerExplosion;
private object Gamecontroller;
private object gamecontroller;
void OnTriggerEnter(Collider other)
{
if (other.tag == "Boundary")
{
return;
Debug.Log(other.name);
}
Instantiate(explosion, transform.position, transform.rotation);
if (other.tag == "Player")
{
if ((playerExplosion != null) && (gamecontroller != null))
{
Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
Gamecontroller.GameOver();
gamecontroller = GameObject.GetComponent<Gamecontroller>();
}
Destroy(other.gameObject);
Destroy(gameObject);
}
}
}