- Home /
Buttons and Touch area issue on android
I am using the android emulator to test my game.
I have two buttons, one positioned bottom left and the other bottom right. These corrospond to the touch areas for zooming and shooting.
void Start(){
touchShoot = new TouchScreenVal(new Rect(Screen.width - 110,Screen.height - 110,100,100));
touchZoom = new TouchScreenVal(new Rect(10,Screen.height - 110,100,100));
}
And the buttons
void OnGUI () {
GUILayout.BeginArea (new Rect (Screen.width - 110, Screen.height - 110, 100, 100));
GUILayout.Button("", style);
GUILayout.EndArea ();
GUILayout.BeginArea (new Rect(10,Screen.height - 110,100,100));
GUILayout.Button("", style2);
GUILayout.EndArea ();
}
For some reason the buttons don't show up at all on the emulator. Also the touch areas arent at the bottom as they should be, they are at the top.
Anyone know why this is?
style
and style2
both have a texture assigned on the normal
background.
Just a question here, why don't you use the premade dual buttons in Standard Assets ($$anonymous$$obile)? There's a premade dual touchpad and you cann assign a texture to each one.
Your answer
Follow this Question
Related Questions
Help with touchscreen controls 2 Answers
GUITexture Button Help, Android touch 2 Answers
Unity Bug, Letting User To touch two UI Buttons as same time (simultaneously) 1 Answer
Button isn't working 1 Answer
How can I fix this Coroutine Camera? 1 Answer