- Home /
Can i use OnMouseDown for Mobile games?
Hi guys I'm creating a mobile games for Android/iOS platform. Now I'm wondering whether I can use OnMouseDown,OnMouseDrag,OnMouseUp to create drag-and-drop function for my mobile games?
Answer by Landern · May 23, 2014 at 01:32 PM
Use the GetTouch method: Input.GetTouch
Also if you search the forums and answers you will find examples written for you, example: http://answers.unity3d.com/questions/621539/how-can-i-drag-the-object-with-touch-mobile.html
Answer by xandermacleod · May 23, 2014 at 01:34 PM
yes for at least OnMouseButtonDown[0], this will be triggered when a touch begins (cant remember if it will trigger a second time in the event that one finger is already touching when another one begins). I don't think it works for OnMouseButtonDown[1]. Also not sure about OnMouseButton[0] or OnMouseButtonUp[0]
You are better off playing it safe with setting up a separate section for touch though using a system.DeviceType check
Your answer
Follow this Question
Related Questions
snap to point remove 0 Answers
How to drag Unity Objects to other c# application 0 Answers
DragAndDrop class bugged? 1 Answer
Drag 2dtexture from inventory to game. 0 Answers
Dragrigidbody help 1 Answer