- Home /
Question by
Kaldos · Feb 14, 2014 at 08:54 PM ·
triggercharactereventboxcollider
Box Collider Trigger not working
Hey, I set up an empty GameObject and attached a Box Collider as a Trigger (2D Game). Afterwards i attached the following script to the GameObject:
using UnityEngine;
using System.Collections;
public class boxSideCollider : MonoBehaviour {
void OnTriggerEnter(Collider other){
Debug.Log ("Enter");
GameObject player = GameObject.FindGameObjectWithTag("Player");
player.GetComponent<CharControllerScript>().Dead();
}
}
Neither the logtext nor the other code appears/works when the character is entering the zone.
Can somebody help me? Thanks!
Comment
Best Answer
Answer by Kaldos · Feb 14, 2014 at 09:48 PM
Found the answer here: http://docs.unity3d.com/Documentation/ScriptReference/Collider2D.OnTriggerEnter2D.html