Game Development Reference
In-Depth Information
But even with the things that it isn't, it still can be a very valuable tool. On occasion
the details in the explanations can get you to the right place. For instance, if you
wanted to know how to play a sound, “play sound” can be entered in the Search
input field where a plethora of classes and variables will be presented. It certainly
takes a bit of wading from there, but do the wading. Lots of important stuff can be
learned along the way when trying to secure knowledge of one topic.
Keep in mind that there is more than one word for a lot of concepts. So for
instance if “play sound” isn't providing the information you think it should, try
“play audio.” Frequently a bit of rewording provides much more usable results.
In the best-case scenario, some of the entries are indeed fleshed out well
and even provide some examples of how to use a particular class or variable.
Many, many a script has begun with a quick copy/paste of the example
followed by a bit of tweaking for the specific situation at hand.
F1 in UniSciTE
On the PC, the script editor UniSciTE has one function that alone is the reason
I do my scripting on my PC rather than my Mac. Select any term within a script
(OnTriggerEnter, for example) and press F1 on the keyboard and the browser
will automatically open and Unity's scripting help will open to that term.
Especially when trying to understand someone else's script or script snippet
that was obtained through the help file, the forums ( http://forum.unity3d.com ),
the wiki ( http://www.unifycommunity.com/wiki/ ), or Unity Answers ( http://
answers.unity3d.com )—all of which are excellent supplemental help
materials—being able to select a function or variable and get that quick
feedback keeps the learning and script building less slow.
Decoding a Help Page
So why talk about the help now? Well, in our past examples, accessing the
Scripting Reference would have provided little help—we simply needed
to provide the starting terms to get going. However, as your scripting
prowess grows, knowing how to decipher the Scripting Reference will
help you make the leap beyond this topic's tutorials and onto your own
killer games.
So take a look at what the Scripting Reference has to say about raycasting.
Select Help>Scripting Reference and enter raycast in the search input field.
Look for Physics.Raycast and click that link. (I know, how would you know to
click that one instead of any of the other options? You don't, it's likely this
would require some wading, but we'll save the time today and jump right to
where we need to be.)
This will bring up the page for the Runtime Class of Physics.Raycast
( Figure 14.4 ). There is lots of information on this page, in fact so much it can
be tough to know what's relevant for our particular situation. But focus for a
minute on the line immediately below Physics.Raycast.
Search WWH ::




Custom Search