Want to do an on-hit effect for a trail renderer in 2D
I am trying to make a simple game to get more practice in Unity. In this game the player controls a triangle which just turns around and fires raycasts to see if it hit an enemy. If it does the enemy is simply removed from the scene. I added a trail effect to an empty game object which is emitted from the player when it shoots. I want to find a way to know when the trail hit the player and to then do a small on-hit effect. However I cannot find something that is not very dated that shows me how to do this. I think that a problem that I may also encounter is that the raycast might delete the enemy game object before the trail gets to it.
Any help on how I could make this work would be greatly appreciated.
Your answer
Follow this Question
Related Questions
Unity Trail for Eyes 2D 0 Answers
Issue with 2D raycast 0 Answers
Problem with raycasting towards mouse 0 Answers
Line of sight for multiple targets - AI - in a 2d game 1 Answer
Raycasting Not Working 1 Answer