Convert game to Android
I have this game that I created first for pc to test, now I want to put it in my android, in the code I have some function like OnMouseDrag() and some other normal ones... How do I put and make it work in my android? Is unity going to convert the code by itself???
Thanks
Answer by Lukx31 · Dec 08, 2015 at 05:36 PM
@STUDIOCRAFTapps ok, I've never made a game for android, all my games that I made were for pc, so I kind of lost myself reading the touch part, could you give me an example? Thanks anyway
Is the draggable object is an UI, gameobject or an GUI?
@STUDIOCRAFTapps it's a gameObject, a cube with a rigid body and collided (trigger)
Answer by StuwuStudio · Dec 08, 2015 at 05:02 PM
OnMouseDrag() need to be replace with an unexacting function, for recreate the OnMouseDrag fonction, you need to detect if the 'touch' is pressing and moving the object. For see if the finger is moving, get the position of the touch and subtract with the position of last frame. If there's a small difference, don't move the object else, alling the object with the pos of the touch.
It's complicated but you need to try.
There's an small Youtube to tutorial :) https://www.youtube.com/watch?v=g9p9PvnmRXU&ab_channel=crevelop
Your answer
Follow this Question
Related Questions
Event on mouse up 2 Answers
Confine mouse to a plane 1 Answer
Problem with Mouselook script 0 Answers
TopDown Look at mouse 0 Answers