Hey guys, I’ve been trying to make an image appear when I collide with a trigger.
I’ve added an Image UI component and even written a script to make it appear, but the image instead replaces my player character. I have had no clue why this is happening, I hope one of you could help me out.
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.tag == "Collectible")
{
cherries += 1;
cherryText.text = cherries.ToString();
memoryText.text = "Sample Text";
customImage.enabled = true;
}
}
private void OnTriggerExit2D(Collider2D collision)
{
if(collision.tag == "Collectible")
{
memoryText.text = "";
customImage.enabled = false;
}
}