Drawing Lines For Lasers

Hello, everyone! I have a ‘laser gun’ on a space ship in my game. The cursor is a reticle used for aiming in my game.

When I click on an object, I’d like to have a line drawn from point ‘a’ (a predefined variable (the ship)) to point ‘b’ (The object I click on in 3D space)

How would I do this? Thanks!- YA

I want it like this:

Go to 1:06 to see him shoot

I believe a LineRenderer would be the best solution for that.
Use SetPosition to set the start and end points of the renderer.

Edit:

If you click on an object you can find it’s center with collider.bounds.center.

If you click in empty space, well then, do you still want to fire a laser that way?
You may be able to find the position in space by using Camera.ScreenToWorldPoint.