Hello,
I’m new with Unity.
I want to detect collision between 2 sprites.
I add 2 Box Collider 2D but there is no collision detection.
This script doesn’t work :
void OnTriggerEnter2D(Collider2D other) {
Debug.Log (other);
}
void OnTriggerExit2D(Collider2D other) {
Debug.Log (other);
}
I have to add a RigidBody in one of my sprite to detect collison.
But I don’t want any physic engine in my game.
Thanks.
1 Like
spayced
2
You can’t avoid the rigidbody. But you can avoid the physics.
http://unitygems.com/mistakes1/
Attach a rigidbody to your sprites with gravity scale set to 0 and a box collider and it will work. This is by in fact the way box2d is designed.
1 Like