Emulating screen touch on devices

OK, I appreciate this is a weird request but to the way my app was written by the original programmer I have to make this stupid compromise.

But, is there a way to emulate a screen touch on an actual device

Code:

if ( XX conditions met)
         automatically press on screen button at xx,yy co-ordinates

Is this possible?

Thanks!

Input.Touches is read only, otherwise you could put your fake touches into it.

One regularish programming trick is to first scoop out the guts off each touch result into doButton1Stuff() and so on. There may be some local vars used through-out the input code. You may have to move them to global (since doButton1Stuff can no longer see them. A slob trick, but works.)

That will let you test using all the regular button touches (assuming they still work.)

Then you can add if (XX conditions met) doButton1Stuff();