How to hide/unhide a GUI image when character enters trigger.

Hey! Im pretty new to Unity and currently making a 2D platformer game. I want a GUI image to appear when my character enters a trigger box, i have placed the image in the scene and hidden it and connected a trigger to it as it’s child. Then I made a script and placed it on the trigger, the script looks like this.

#pragma strict

private var textboxshow: boolean = false;

var textbox: UnityEngine.UI.Image;

function OnTriggerEnter2D(Col: Collider)
{
	if(Col.tag == "Player")
	{
		textboxshow = true;
	} else {
		textboxshow = false;
	}
}

function OnGUI() 
{
	if (textboxshow == true) 
	{
		GetComponent.<Renderer>().enabled = true;
	} 
}

And when i enter the trigger volume the image does not appear, what have I done wrong? All help greatly appreciated!

(Edit: Fixed Collider to Collider2D, still does not work however)

Hello, do you have rigidbody on both collider and trigger. This is required even if you are not using physics, just set it to kinamatic. Also in your OnTriggerEnter. Add
if(col.tag == (“Player”)
print(“Player enter trigger zone”)

Use that to check if you are entering the trigger, also make sure your player has the tag Player.

Also if you have the gameobject disabled, the trigger shouldnt work.