Game Development Reference
In-Depth Information
Figure 8-13.
The Line Renderer component in the Inspector
In the Inspector, uncheck Cast Shadows and Receive Shadows. The basic version of Unity doesn't
use shadows so leaving these checked would not add shadows.
Materials
indicates the material to be used for drawing the line. If None, the default is the magenta
line you see in the Scene view. You must have a material in order to change the color of the laser
beam. In the Project panel select Create ➤ Material and name it SimpleLaser. Drag the SimpleLaser
material into the Element 0 property in the Inspector. With this material selected, in the Inspector use
the Shader drop-down menu to select Particles ➤ Alpha Blended. The Line Renderer uses Particles
materials; otherwise you would just get a black line.
Reselect the LaserBeam game object to display its properties in the Inspector again.
Light
Probes
are another Unity Pro feature.
Positions
designates the points the line is drawn between.
A line needs a minimum of two for the start and end points, but you can add additional points by
increasing the value of the
Size
property.
Expand
Parameters
for more customization options. Change the values of
Start Width
and
End
Width to
0.05 to make the line thinner, change
Start Color
and
End Color
to a bright red, and check
Use World Space
.