How do I add a Rigid body and a box collider component to a Texture2D?
- by gamenewdev
I am making a snake game. I'm basing it on a basic tutorial game, which does no collision detection, wall checking or different levels.
All snake head, piece, food, even the background is made of Texture2D. I want the head of the snake to detects 2D collisions with them, but Rect.contains isn't working. I'd prefer to detect collisions by onTriggerEnter() for which I need to add BoxCollider to my snakeHead.