Reflective laser 2D, unity.

Hi everybody!
I was wondering what’s the best way to create bouncing laser in unity in 2D mode. Is it:

  • creating plane, putting texture on it
    and stretching along RayCast
  • LineRenderer (there are some bugs about it, for example: width isn’t constant when there are many bends/count of vertices)
  • list of linerenderers (but then how get exact linerenderer from list in case of we wanted destroy or change it somehow)
  • new method that I don’t know?

I have problems with creating easy game a’la Lasers&Mirrors from Android Google PlayStore. I’m tired of it and that’s why I’m asking you here.
If you could, please, give some pro tips or partial code of how to create such laser.
Sorry for noobish approach, I’m totally new in it.
Thank you in advance!

What you could do:

  • raycast from one hit point to the next at the desired angle until you either reach a limit or the outer walls (whatever stops it)
  • from each hitpoint draw either a 2 vertex linerenderer to the next (helps not getting folded ends), or a generated quad
  • the quad will give you more precision on the ends (like keeping it parallel to the surface you hit), but that’s more work of course
  • You can also program a particle emitter to generate lines
  • In addition place cool looking glow points on and aligned to the hit surfaces

Of course you’ll need to keep track of hitpoints, renderers etc, but just recalculating everything everytime the laser origin is modified should be enough

How’s that?