Drag and drop Unity

0

I'm trying to develop a simple Android game in Unity, with drag and drop objects.

I used the following method to get the object:

public void drag(){
    transform.position = Input.mousePosition;
}

Problem: Accepting simultaneous ringtones on the screen and want to accept only one touch at a time

How can I resolve this?

    
asked by anonymous 30.10.2018 / 17:49

1 answer

0

As you are developing for android, you can treat the touches separately, like this:

Touch myTouch = Input.GetTouch(0);

    Touch[] myTouches = Input.touches;
    for(int i = 0; i < Input.touchCount; i++)
    {
        //faca algo com cada touch
    }

If in your case only the first input is of interest, just use index 0 in the myTouches vector.

    
30.12.2018 / 20:02