Ok so I want to make a door that will open if get near it and I have 2 door sprites setup (one for an open door and one for a closed one). The door itself has 2 colliders one that you can collide with and one that is a circle collider witch I use as a trigger. If you activate the collider then the sprite should change and the main collider should deactivate. But the OnTriggerEnter event in my script isn´t working I have tried debugging it for quite some time. I really need help. Thanks
Heres the code for the Door.
´using UnityEngine;
using System.Collections;
public class Door_Logic : MonoBehaviour
{
public Collider2D collisionCollider;
public Sprite closed;
public Sprite open;
SpriteRenderer sprRender = new SpriteRenderer();
void OnTriggerEnter (Collider col)
{
if(col.gameObject.tag == "Player")
{
sprRender.sprite = open;
collisionCollider.enabled = false;
}
else
{
sprRender.sprite = closed;
collisionCollider.enabled = true;
}
}
}