Why does this script I got from the Unity Document site does not work?

I got the error: "Assets/Scripts/_pistolAI.js(7,47): BCE0019: 'GetTouch' is not a member of 'UnityEngine.Input'. Did you mean 'GetKey' ?"


// Shoot a ray whenever the user taps on the screen
var particle : GameObject;
function Update () {
for (var i = 0; i < Input.touchCount; ++i) {
if (Input.GetTouch(i).phase == TouchPhase.Began) {
// Construct a ray from the current touch coordinates
var ray = Camera.main.ScreenPointToRay (Input.GetTouch(i).position);
if (Physics.Raycast (ray)) {
// Create a particle if hit
Instantiate (particle, transform.position, transform.rotation);

It works fine. I guess you're using an older version of Unity iPhone, in which case you should use the documentation that came with it instead of the online docs (which are always going to be for the most recent version), since Input was handled somewhat differently then. Or upgrade.