Hi, I’m trying to make a wall disappear when it touches and reappears when it is not touched. The wall has two type of collider which a BoxCollider2D for physics and CircleCollider2D for triggering. I’m trying to get rid of the BoxCollider 2D only but it say Expressions in statements must only be executed for their side-effects. Any ideas that might fix this?
Thanks!
#pragma strict
function Start () {
}
function Update ()
{
}
function OnTriggerEnter2D(other: Collider2D)
{
if (other.gameObject.tag=="Player")
{
yield WaitForSeconds(3);
BoxCollider2D.Destroy;
renderer.gameObject.active = false;
}
}
function OnTriggerExit2D(other : Collider2D)
{
if (other.gameObject.tag=="Player")
{
yield WaitForSeconds(3);
BoxCollider2D.Instantiate = true;
renderer.gameObject.active = true;
}
}