Game Development Reference
In-Depth Information
Classified intel
We already knew that we can use
Gizmos.DrawLine
to draw the line in the debug mode,
but drawing the line in the game mode is different. We will need to deal with drawing of
the mesh, setting up of vertices, UVW map, and so on, which might be very complicated
for a beginner. This is why Unity provides us with
Line Renderer
.
Line Renderer
In this step, we have used the
Line Renderer
component as our
LaserScope
. The
Line
Renderer
component is a very convenient way to create a line or/and curve in the 3D
world by taking an array of points and drawing them in an order. We can also add materials
and apply the start or end color to create more variety. This is shown in the following
screenshot: