Game Development Reference
In-Depth Information
After attaching BulletShooter script to the shuttle, the first thing we have to do is to set
the value of bullet . This variable is going to be used as a reference to the prefab needed
to create new bullets. Recall that we have already prepared this prefab and saved it in our
project. So we need now to tell the script which prefab should be the source when making
bullet copies. Binding a prefab to a variable in a script is accomplished by dragging the
prefab to the field of the variable in the inspector as in Illustration 32.
Illustration 32: Binding a prefab to a variable in a script
Search WWH ::




Custom Search