Reputation: 57
I have a two objects, both of them have : rigidbody2D of type dynamic, collider2D set to trigger, same layer, same Z position. But they do not collider with each other. One of them has a simple script attached, which contains function OnTriggerEnter2D, which just debug.log some message. As you can guess the console doesn't print the message. No errors tho. Please help! I've also tried to restart unity, even the PC - doesn't work as well. function :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("DUOA");
}
}
Upvotes: 0
Views: 532
Reputation: 460
Have a look at the Collision action matrix, you will not receive a trigger call from two dynamic Rigidbodies that both have a trigger collider component.
Change one of the Rigidbody types to Kinematic
, which should resolve your issue.
Upvotes: 0