How to make an OnTriggerEnter Script that can make an object appear (Either 2D or 3D)

Hey guys, so I’m working on one of my first projects and I want to make it so you cannot backtrack after entering a room (This is a 2D Space I’m trying to do). Anyways, I tried writing this simple code and the only thing that is happening from this is that the “Cube” I want to blockade the character from backtracking once entering the room is not active at the beginning of the scene which is perfect for what i want. However, the collision with the trigger from an invisible meshed 3d cube is not working to make the door active. Here’s my code.

#pragma strict

var objectToMakeAppear: GameObject;
objectToMakeAppear.gameObject.SetActive(false);

function OnTrigger( other : Collider)
{

if (other.tag == "TriggerObjPlayer") 
{
	objectToMakeAppear.gameObject.SetActive(true);
}

else
{	
	objectToMakeAppear.gameObject.SetActive(false);
}

}

How can I make this work for my scenario?

Remove the else condition.