OnTriggerEnter2D not working
Hi I'm new to using Unity and tried doing collision the original code below is what I tired So then I tried to just put the col.isTrigger by itself in the if statement it doesn't show anything in the console log Help would be greatly appreciated.
public class jabTrigger : MonoBehaviour {
public int jabDamage = 10;
void onTriggerEnter2D(Collider2D col)
{
if (col.isTrigger != true && col.CompareTag("Enemy"))
{
col.SendMessageUpwards("underAttack", jabDamage);
Debug.Log("collision");
}
}
Enemy script
void Update () {
if (currHealth <= 0)
{
Destroy(gameObject);
}
}
public void underAttack(int damage)
{
currHealth -= damage;
Debug.Log(currHealth);
}
}
Comment
Best Answer
Answer by OncaLupe · Dec 05, 2015 at 11:07 PM
Method name is case sensitive: OnTriggerEnter2D().