Alright, so I’ve got two game objects with 2D box colliders (one player-controlled and one unmoving) seem to be refusing to detect each other. I’ve got a script to destroy the unmoving object when the two come into contact:
using UnityEngine;
using System.Collections;
public class DestroyOnContact : MonoBehaviour
{
void OnTriggerEnter2D (Collider2D other)
{
Destroy (gameObject);
}
}
I’ve tried colliding them with Is Trigger turned on for both objects’ colliders, I’ve tried turning off Is Trigger and using OnColliderEnter2D, and I’ve even tried just using OnTriggerEnter/OnColliderEnter without the 2D bit. They just refuse to interact with each other at all. I’m probably missing something simple, but I can’t think of any possibilities that I haven’t tried. Oh, and they are on the same layer, in case that’s relevant/important. And at the same Z position, though from what I understand that shouldn’t matter.