Simple touch hold controls?

I just got Unity iPhone, and I have to change my input system to work with it, since I was using a gamepad/keyboard before.
I have been looking around at many tutorials and examples, but they all do more then I want, and I’m a little confused :face_with_spiral_eyes:

All I want to do for now is make my vehicle go when touching any part of the screen. What’s the simplest way to do that, and how can I also make it work with a mouse click (for testing on Unity PC…)

Thanks in advance!

The mouse input functions in Unity all work on the iPhone too (they attempt to take the obvious interpretation from taps, drags, etc). You can probably do what you want with something like:-

if (Input.GetMouseButton(0)) {
  // Start vehicle.
}

This will work the same on all platforms.

andeeee, thanks for this info, works like a champ on both PC and iPhone.

Now, I want to create a rectangle on the right side of my screen, and only start accelerating if the mouse click position was detected within the rectangle bounds. I know how to get the mouse position (Input.mousePosition), but how do I check if it happened inside the Rect bounds?

Look at this iPhone tutorial for good examples of control schemes.
http://unity3d.com/support/resources/tutorials/penelope

I have been looking at the Penelope tutorial more and more lately, but to tell you the truth, the controls they use in that tutorial are way more then what I need, and I’m not using a GUITexture either. All I want to do is define a Rect on the right side of the screen and then check for mouse clicks/touches within that rectangle. If player clicked/touched within the Rect I would then make the vehicle move.

You can check if a coordinate falls within a rectangle using the Rect.Contains function:-

var controlRect: Rect;  // Set from the inspector, say.
  ...

if (Input.GetMouseButtonDown(0)  controlRect.Contains(Input.mousePosition)) {
  // Button action.
}

Perfect, that’s exactly what I needed. Thanks andeeee!