I’m going through the collider part of the course, got the circle working as the video shows. However, when I added the rectangle and set its ‘Is Trigger’ checkbox to checked, I don’t get the call to OnTriggerEnter2D to tell the collision script that it happened.
My code looks like trhis:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collision : MonoBehaviour
{
private void OnCollisionEnter2D(Collision2D collision)
{
Debug.Log("Ouch!");
}
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("Trigger!");
}
}
These are the Car Object settings:
and these are the Square Object settings:
Did I miss something here? I have the Square object set as a trigger, yet no call to the collision script.
I hate to be such a bother, but I don’t want to leave something in this course not working assuming it will fix itself later.
I’m using Editor Version 2022.3.26f1