- Home /
Question by
kocha_belgisi · Apr 22, 2020 at 06:51 AM ·
oncollisionenter
OnTriggerEnter is not Working
void OnTriggerEnter(Collider collider)
{
Debug.Log("Collision");
}
The code at the top isn't working at all. Both object have a collider component, on the first object the collider is a trigger and the second object has a rigidbody that isn't kinematic. The Script is on the second object. What could be the Problem?
Comment
Are you using a 2D or 3D collider? If you are using a 2D collider you need to be using OnTriggerEnter2D.
Answer by K00KIE · Apr 22, 2020 at 09:30 AM
Ahhhhh You need to mark the gameobject with script as "istrigger" If that is not an option use oncollisionenter().