1
votes

Can I touch GUI button on touch screen. In my script, I write this code for button click with unity c# script on Unity3d game engine.

if(GUI.Button(new Rect(100,100, 300,300),"ok",style) {
     //do stuff
}

When I use mouse click, it makes actions but on the touch screen, it is not work. I want to use it with both mouse click and touch on button. So can you advice how to make it?

2
Are you testing touch on Unity remote? - Dinal24
yes, unity remote installed on my android smart phone - user4025587
There are a lot of known issues in Unity remote for android! I'll add an answer! - Dinal24

2 Answers

0
votes

Unity GUI.Button() do support touch inputs. You do not need a separate implementation but there are some glitches in the Unity Remote. Best is to test it on the device straightaway.

0
votes

Unity Remote is Restrictions tool... you run project in Unity Editor. because, GUI.Button() event only pass mouse click event. Best way. Try using Bulid&Run option. :D