What do you mean when you say it’s ‘not working’? Are you not getting collisions? Are you getting collisions, but the code doesn’t do what you expect?
Things to always check when you don’t get collisions is:
- Is there a
RigidBody
on at least one of the objects? - Is there a collider on both objects?
- Is the collider marked as ‘Trigger’ (it shouldn’t be in this case)
- Is the
CollisionHandler
script on the same game object as the collider?