- Home /
[Unity] 2D Trail with collider for a tron like game
I'm making a tron like game on a 2D plane and I need to make a trail behind a moving point so that when a player/object collides with that trail it triggers something ( maybe a screen that says game over ). I found this amazing script that is doing exactly what I need:
http://wiki.unity3d.com/index.php/TrailRendererWith2DCollider
The only problem is that I don't know how to detect WHEN the trail is colliding with another object/collider. I tried OnCollisionEnter2D and OnTriggerEnter2D but I don't get any results, the functions are not called no matter what I do.
I am a newbie with programming and I've been using unity for only 2 weeks now so please be patient with me. I also found some other question on this topic but I still can't figure this out.
I only have a rigidbody2D on the moving point( because the collider is added from the script) and a rigidbody2d with a collider on an object I'm testing the collision with. And it still doesn't work. The thing is that I want to use too many unity proprieties since I want to make it as simple as posible, so I would like to make it work without a rigidbody.
You need colliders on both objects, and a rigidbody on at least one of them, or else no collision functions will be called.
Your answer
![](https://koobas.hobune.stream/wayback/20220613184144im_/https://answers.unity.com/themes/thub/images/avi.jpg)