0
\$\begingroup\$

I'm making a test game for Android in Unity 5, and I want to add left-right control buttons like the circles below, to move an object left or right.

a left and right button under a simple game view
(source: raywenderlich.com)

How can I do this?

Sorry if this question is basic. I'm new to Unity and I don't understand the methods of existing tutorials.

\$\endgroup\$
2
\$\begingroup\$

Since Android devices don't have left/right buttons (well, a long time ago they used to, and if you use bluetooth keyboard/gamepads they will), what you want is onscreen buttons. If you search for that then you will find plenty of answers and tutorials.

The easiest method is to use the built-in GUI.Button class. There are many other ways to do it, such as detecting touch events and checking if they intersect some part of the screen.

\$\endgroup\$
  • \$\begingroup\$ So I need to add any object and write a script for OnTouch or OnClick on the object ? \$\endgroup\$ – Gissipi_453 Mar 25 '15 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.