Game Development Reference
In-Depth Information
Step 4: Declare a gunSpark variable. We're telling the script to instantiate
whatever is residing in gunSpark, but we haven't declared a variable to hold
it yet. At the top of the script, include the following variable declaration:
var gunSpark : GameObject;
Why?
We still need to build this gunSpark, but we have the container and
mechanism now to access it.
Step 5: Save and return to Unity. Fix any syntax problems that pop up in
the console.
Step 6: Populate the Gun Spark variable. The AC_ToolFunctionalityScript is
(or should be) attached to Main Camera (the one that is a child of the now
FPC_AegisChung). Select Main Camera in the Hierarchy, and then in the
Inspector look for the “AC_ToolFunctionalityScript (Script)” component.
From the Character Assets folder in the Project panel (in the Character
Assets folder), drag the PistolSparks prefab onto the Gun Spark variable
input field of the Inspector.
A Few Notes about Pistol Sparks
If PistolSparks is selected in the Project panel ( Figure 15.16 ), you can see
the settings of this particle system. It's actually just a variation of the Sparks
prefab that was included back when we imported Unity's Particles package. In
the Ellipsoid Particle Emitter section it has smaller values for Min Size (0.005)
Figure 15.16 The very critical
AutoDestruct for PistolSpark.
Search WWH ::




Custom Search