This code works great in the editor, but after I build the game (I’ve tried building both standalone and web applications) the OnCollisionEnter function no longer runs. If it works correctly, when the player runs into a monster the game ends. Here’s the code:
void OnCollisionEnter(Collision collision)
{
if (this.tag == "Player" && collision.collider.tag == "Monster")
{
game.gameOver ();
}
}
Any ideas on why this wouldn’t work after the build?