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");
}
}
question from:
https://stackoverflow.com/questions/65852584/problem-with-trigger-in-onttriggerenter2d-in-unity 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…