Question by
stefanceltare12 · Apr 03, 2020 at 05:11 PM ·
2d2d-physics
I can not detect collisions !!! Pls Help !!! I have put colliders on all objects and a Rigidbody2D on the one with the script. I have also put the object to dynamic, not kinematic. Also, I am new to unity.
using UnityEngine;
public class BallCollision : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D collider)
{
Debug.Log("pls work");
}
Comment
@stefanceltare12 , is Trigger is set on one of the Colliders?
Best Answer
Answer by sztobar · Apr 08, 2020 at 09:25 PM
Do your colliders have isTrigger
property? OnTriggerEnter2D
callback is called only when contact with trigger collider. Read more about it in unity docs
Answer by stefanceltare12 · Apr 03, 2020 at 05:32 PM
I have a "}" at the end but I forgot to put it here.
Your answer
![](https://koobas.hobune.stream/wayback/20220612230431im_/https://answers.unity.com/themes/thub/images/avi.jpg)