TouchPhase interference with two functions

Hello!

First of all this forum has been really helpful for me to deliver my first game. Now I’m starting on my second one and I’ve run into a problem with TouchPhase that I simply cannot solve. I tried searching for an answer and couldn’t really find a proper one, so that’s why I am posting this as a new question. Here goes:

I have a birds-eye view style strategy game in the making and I have been implementing the basic functionality like selecting unit and moving it, health, basic AI and such. Last night I was implementing a camera system to be able to drag and pan the camera to scroll the play area. I have tied my unit moving to TouchPhase.Ended that does a raycast to determine the point where to move…working flawlessly, but the problem is that it interferes with the camera panning: I have unit selected and start dragging the screen. When I release the finger to stop dragging the view, TouchPhase.Ended is sent and the unit reads that as a command to move to that point where I released my finger. How can I avoid this situation that if I was dragging the view, I didn’t mean to move the currently selected unit?

Thanks in advance!

-drfroz

I have resolved this problem now by using boolean check…