Game Development Reference
In-Depth Information
Scripts as Behavior Components
Continuing on from our previous project, select Assets ➤ Import Package ➤ Scripts in the editor top
menu (as shown in Figure 4-1 ).
Figure 4-1. Scripts found in Unity's Standard Assets
Import all, and in your Project panel you'll see a new Scripts folder appears in the Standard Assets
folder. Double-click the Scripts folder to open it, then select the Camera Scripts folder to reveal the
contents. Here you'll find the three scripts: MouseOrbit, SmoothFollow and SmoothLookAt, as you
can see in Figure 4-2 .
Figure 4-2. Standard Assets camera scripts
The MouseOrbit script is going to act as a behavior component for the Main Camera. The camera's
viewpoint will be focused on a single game object and you will be able to control its movement
around the game object with the mouse.
You can add the MouseOrbit script to the Main Camera a number of ways. You can drag it from the
Project panel and drop it on Main Camera in the Hierarchy view, or you can drop it directly on the
Main Camera game object in the Scene view. When you try the second option, you'll see a green
circle with a white plus in it when you have dragged it close enough to the Main Camera game object.
 
Search WWH ::




Custom Search