- Home /
Question by
tbuchholzdesign · Jul 25, 2014 at 12:12 PM ·
touchscreen
Can Unity be used to create touch based controls on Mac Platform?
Looking to create touch controls on a large format touchscreen for a mac. Not sure if there is special coding for this or if it is similar to how the Windows 8 is programmed.
Comment
Answer by SilentSin · Jul 25, 2014 at 01:44 PM
Unity treats touch input like mouse input.
Calling Input.GetMouseButton(0) will tell you if mouse button 0 (left click) is being held, or if the screen is being touched on a touchscreen device. Likewise, Input.mousePosition will give you the position of that touch.
If you want to do anything more complicated (like multi-touch), then you have to use Input.touches which gives you an array of all the current touches to look through.