This is all very interesting, except that we're fairly far away from our creation and we lack the ability to move around the scene. With traditional iOS devices we can accomplish this by accessing the accelerometer within the device:
Unity encapsulates all of the functionality of the accelerometer into the
Input
class and we can use its attributes and methods to connect to the accelerometer and determine what is going on with our device.
NewBehaviourScript
.Update
function:Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Scripts must, generally, be attached to Game Objects to do anything useful. In our case we want to move the camera around so we need to attach this script to the camera. There are two ways to accomplish this in Unity. As with texturing, you could simply drag the script onto the camera.
The other way to accomplish this task is to select the Main Camera in the Hierarchy view and, subsequently, in the Unity menu bar select Component | Scripts | New Behaviour Script.
In either case you will find that Unity has added your script to the camera:
18.218.91.239