I am making a game. In my game, a ball is going around and if it hits a trap, it will die, and you will have to restart. My problem is: I can't figure out a way to make a button appear on the current scene when you hit the trap. Im scripting in C#.
using UnityEngine;
public class PlayerCollision : MonoBehaviour{
public Rigidbody rb;
void OnCollisionEnter(Collision collisionInfo)
{
if (collisionInfo.collider.name == "Trap_Spike")
{
FindObjectOfType<Gamemanager>().RestartGame();
}
}
}
The trap has the tag Trap_Spike on it.
My RestartGame script looks like this:
using UnityEngine;
public class Gamemanager : MonoBehaviour{
public void RestartGame()
{
}
}
So I'll be open for any help I can get