Collision detection in 2D
Hello,
I'm trying to use the OnTriggerEnter2D method so see when a enemy is within range of a stationary object.
I have it set up like this:
The enemy simply have a CircleCollider2D set to trigger.
The object have 1 ridgidbody2D, with gravity scale 0 so it stays in place. (not kinematic) and CircleCollider2D also set to isTrigger. It also have a script with the following code:
void onTriggerEnter2D(Collider2D enemy) {
Debug.Log("lala");
}
but nothing happens when the enemies move within range, what am I missing?
Comment
Best Answer
Answer by haiderInUnity · Jan 31, 2016 at 05:50 PM
You just have a small typo. instead of onTriggerEnter2D it should be OnTriggerEnter2D. Notice on should be On. @Taxen0
Your answer
![](https://koobas.hobune.stream/wayback/20220612062437im_/https://answers.unity.com/themes/thub/images/avi.jpg)