0

I am writing playmode test case. I want to simulate touch/click at certain co-ordinate on screen for example (100,100)

So far I just found following code

Input.simulateMouseWithTouches = true;

Any idea how simulate touch at a point in unity playmode test case?

Blue
  • 820
  • 4
  • 17
alphanso
  • 409
  • 5
  • 22
  • Injecting synthetic events into unity legacy Input System, or into its Event System is very tricky. To make it testable/simulatable, its useful to from an intemediate layer. Make your handing of the multi touch accept a reasonable parameter set, than you can call it both using the actual touch surface feedback, and your test code. – zambari May 08 '22 at 20:03
  • how can I do it? – alphanso May 09 '22 at 06:50
  • hard to propose anything without seeing what you are trying to do with the touch events – zambari May 09 '22 at 12:55
  • Want to simulate normal touch anywhere on the screen – alphanso May 09 '22 at 14:49

1 Answers1

0

You want one-touch, two-touch, multi-touch detection on the screen, don't you? You can use Input.GetTouch to get touch information. To count the number of touch on the screen, you use Input.touchCount and TouchPhase to check the status of the touch.

Viettel Solutions
  • 1,519
  • 11
  • 22