- Home /
How do you map touch to one of the input axes?
What I mean is that if say I have a GUIButton as a control scheme how do I map it to the input axes(e.g. fire1,fire2,jump). If someone could show me how or post a script that would be great. Thank you in advance.
Answer by beayfergm · Aug 06, 2013 at 09:19 AM
I think that is not possible with Unity itself.
The most common approach is to implement an intermediate layer that manages the Unity native input.
Something like:
class MyIntermediateLayer
{
public static void ButtonFirePressed()
{
Debug.Log("ButtonFirePressed");
}
}
// Example using a generic Update call
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
MyIntermediateLayer.ButtonFirePressed();
}
}
// Example using a GUIButton
void OnGUI()
{
if (GUILayout.Button("Press HERE"))
{
MyIntermediateLayer.ButtonFirePressed();
}
}
Could you explain about how to use it. And, also is it in C++ or Java(UnityScript)?
Your answer
Follow this Question
Related Questions
Control the camera with a half of the touch screen 0 Answers
Touch Controls for a 2D ball game 0 Answers
Touch joystick tutorials ? 0 Answers
Raycast Touch Android not working JS 2 Answers
Video player app button touch input working on android not on ios 0 Answers