Hi, sry for this question. I know it’s full but i not found solution in other post…
I’m doing a simple endless runner but my triggerEnter2D not working. Now i explain what i do in my project:
I have a immobile Obstacle that have a Collider2D and Rigidbody2D (unchecked simulated) with a script that use OnTriggerEnter2D:
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("enter");
/*if (collision.CompareTag("SpawnOffArea"))
this.gameObject.SetActive(false);*/
}
I have a square object with Collider2D trigger that attached at camera.
My camera follow the player with this function in Update method:
private void FollowPlayer()
{
this.transform.position = new Vector3(player.transform.position.x + offset, 0, this.transform.position.z);
}
I had tried to use rigidbody also and only on the Collider trigger but nothing.
But it doesn’t trigger anything and I don’t understand why. (I have verified that the Z axis is the same and it is, except camera.)
Physics2D settings seem fine (I also reset).
(someone can change title in “OnTriggerEnter2D not triggered” pls?)