Hi. I am making a swipe script, but it is a swipe between two objects, so I have to detect that in both pressed and released gestures those objects were pressed. The problem is that I don't know the right method to get the GameObject once a gesture begins. I thought that I could do it getting the PressedGesture name (as a debugging), but it returns me a Swipe Controller name, so I am not getting the right GameObject name.
This is the code on which I tried to get the game object name:
private void pressedHandler(object sender, EventArgs e)
{
PressGesture gesture = sender as PressGesture;
TouchHit hit;
gesture.GetTargetHitResult (out hit);
startPos = hit.Point;
if(gesture.gameObject == this.swipePositions[0]) //Swipe Positions stores both GameObjects I mentioned fr the swipe...
{
Debug.Log ("Pressed on: " + gesture.gameObject.name + " at: " + startPos);
}
else
{
Debug.Log("Not even from the start...");
Debug.Log("This name is: " +gesture.gameObject.name); //Returns "Swipe Controller"
Debug.Log("The name should be: " +this.swipePositions[0].name); //Returns "Cube" (the actualo name of the object)
}
}
Thanks in advance.