I'm making an alien shooting game. I use the accelermometer to move my player.
and is it possible to use an image for that certain button. (i want to design how the button looks like in photoshop)
Please Help, Thank you very much and sorry for the bad English. :D
The easiest way is to use the standard buttons: http://docs.unity3d.com/Documentation/ScriptReference/GUI.Button.html And script the functionality you want.
answered Jul 03 '12 at 05:47 PM
The keyword is 'Joystick'. You have a demo scene under Standard assets(mobile), try to play with. The script you can use is named Joystick.js there.
You can use 2 rectangle "Joysticks" (with 'Is touchpad' option checked) for rotating and moving, and 2 "Joysticks" for shooting and stuff. I already have this system working properly,
Of course, you can use your own textures for the joysticks (transparent .png for example), to make these to look as buttons. The option to change texture it's on joystick component options.
Note the joystick positions are relative to the screen (0 to 1 on vertical and horizontal). You can attach the joysticks to a new empty object. I use this kind of object positioned at (0,0,0) in the world space (the difference it's important since the player is moving around and buttons must stay on the screen)
You can see the joystick if you add texture for it. Size an positions you can change using (in Inspector) Transform position and Pixel Inset values (these are the most important)
The basic steps:
Placing many touchpads require some exercise but finally will see are not so difficult.
You don't need to read, understand and change all Joystick.js script to make touchpads working. Also, on Unity forum already exists some scripts to handle with accelerometer;
I don't know how to upload here a simple package with all you need to see how few touchpads may be used togheter.
Anyway, if you have trouble with touchpads, the Luci85 solution (use standard buttons) it working also.