- Home /
Displaying a collision with Obstacle with text on screen?
I´m working on a Roll a Ball game and I want to show a text when my player hits an obstacle, but I cant find a real tutorial for this, so I hope you can help me. I see it in the console but I want it to be on the screen when I collide with the obstacle. The code below only shows it in consol.
Pls help :)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerCollision : MonoBehaviour {
public PlayerMovement movement;
void OnCollisionEnter (Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Obstacle")
{
movement.enabled = false;
FindObjectOfType<GameManager>().EndGame();
}
}
}
Comment
Your answer
Follow this Question
Related Questions
GUI Text Problem 2 Answers
Destroy All Objects In The Scene??? 1 Answer
completely lost noob 1 Answer
The 3D camera no longer exists -> AudioListener Spam 2 Answers