I have this code to display text when my space ship is colliding with another object, but I can’t figure out how to turn the text off if I’ve stopped colliding with the object.
Thanks for any help!
public GameObject text;
private void Start()
{
text.SetActive(false);
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject)
{
text.SetActive(true);
}
}