I am trying to use the UI buttons to create a button on a canvas that when clicked, will work as if you pressed the button on the input axis. In this case I am trying to use the “horizontal” axis being triggered as positive or negative if you press the left or right button that display on the screen with the canvas. Please explain how to accomplish that, and if more details are needed just ask.
You are effectively trying to implement a virtual joystick. There are loads of resources to show you how to do that, including the “Standard Assets” package provided by UT on the asset store:
Thanks for your suggestion. I look through the Standard Assets, but unfortunately I could not find anything like a virtual joystick. Could you point me in the right direction?
Edit: I did find the dual button control and other things but nothing like i want. I want like 4 buttons for the horizontal and vertical axis (up, down, left, right) and then 4 more buttons, but I can achieve what i want from those with the 4.6 UI tools.
Check this out: http://forum.unity3d.com/threads/using-the-virtual-input-script.319091/
What you are looking for is the “CrossPlatformInput” stuff including the “VirtualInput”
If you download the entire package to a sample app, you’ll see the touch pad controls in action which work virtually as Axis. That should point you in the right direction.
also can you explain what “Set-up Android SDK path to make Android remote work” means and if that is why the prefabs don’t work and how to do that?
Do i need to set up the path to make a mobile game?
Sorry this is my first mobile game, and I’m an indie developer so yeah
The CrossPlatformInput work is mostly all scripts, you don’t have to use the prefabs. They just show you how to make virtual controls. You can also google for “Unity virtual joystick” and you will find lots of other examples / tutorials on this. Too much info to go in to on a forum
As to your question on Android. That is just a setting in the menu of the Unity Editor “Edit → Preferences → External Tools”, there is an option to point Unity to your install of the Android SDK (if you haven’t installed it yet, go to “http://developer.android.com” and download the latest).
You only need to set this if your build target is Android and you are trying to Export the project to an Android Build.
You can leave your target as Windows / Web to begin with while you are developing / testing.
SimonDarksideJ can u help me i know how to use the joy stick but i need to use like tow arrow bottons one on is a left button and the other is a right botton and assigne them to the input manager and when i press the right botton is like i pressed the axis positive botton and the same to the left button please help because other people asked this but the answer is " you can use the joystick" but the joystick in some cases is not the best solution please help and thax
The virtual joysticks sample included in the Unity examples should be sufficient for most cases.
For your example, yes they are right that the joystick is generally the best method because you are actually faking an axis (just only use the Axis you want). If you want more of a “Press to increase / decrease” style of effect, then you will need to manage the current value for the axis and increase / decrease it based on the press.