• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by snowangel912 · May 23, 2014 at 01:29 PM · draganddrop

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?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · May 24, 2014 at 07:46 AM 0
Share

it works fine, yeah.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Does Input.mousePosition works for iphone ? 1 Answer

OnGUI() not called during DragAndDrop 0 Answers

Problem with dragging objects 1 Answer

how can i determine that my container is fill with another object ,e.g when i drag an object and drop into another container 1 Answer

Drag and Drop Javascript 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges