O'Reilly logo

Unity 4 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a MouseLook script and laser target scope

From the previous section, we have the basic control setup for our robot to run, walk, aim, or shoot. Now, we need a script to control our character's rotation using the mouse while the character is aiming. We also add the laser target scope object, which will be used by the player to aim.

Engage thrusters

We will now create the MouseLook script to control our character by performing the following steps:

  1. We will create the MouseLook script that will control our entire menu; go to Assets | Create | Javascript (for Unity JavaScript users) or Assets | Create | C# (for C# users), name it MouseLook, double-click on it to launch MonoDevelop, and we will start writing some code.
  2. Open the MouseLook script ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required