- Home /
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
Answer by drfroz · Sep 28, 2011 at 11:07 AM
I have resolved this problem now by using boolean check...
Your answer
![](https://koobas.hobune.stream/wayback/20220612224314im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to exclude specific touch area! 4 Answers
Swipe horizontally and hold finger down to move character? 1 Answer
Check whether touch is held 0 Answers
Restricting OnGUI to test for touches inside of a RECT???(Unity iPhone) 2 Answers
Not getting a response when a touch doesn't move with TKtouchkit 1 Answer