Prefabs
folder there is a Dual Joysticks
prefab: This figure represents what we expect to see – our two Joystick nubs in the user interface ready for user interaction. If you start your application on your iOS device you will see that as you place your fingers over the joystick nubs, they will move around as your fingers manipulate them during a touch. When you remove your finger from the nub it will snap back to the center position. This information is captured by the Prefab and passed off to the built-in Joystick script.
To pass the input to some other script, simply alter the script that the Prefab is pointing to. Note that each Joystick can have its own script so you can have two entirely different behaviors per joystick.
You can also change the texture that the joystick uses by updating the Texture field on the GUITexture which represents the joystick:
We have just implemented the primary means of input for our game – the dual joystick nubs. As we move these joysticks around they relay data to the Joystick script. While this is interesting, it still doesn't move our character around the scene. If all we needed were some basic joystick processing we'd be done, but we need to control a character and move our camera around the scene. Fortunately, there's a prefab for that.
3.139.238.226