Out of Range Exception

So I’m doing a patrol walk from point to point enemy but when it walks to the first point it stops and I get a script array out of range error and he won’t move and a line of text goes yellow.

using UnityEngine;
using System.Collections;

public class Patrol : MonoBehaviour {
	public Transform[] patrolPoints;
	public float moveSpeed;
	private int currentPoint;

	// Use this for initialization
	void Start () {
		transform.position = patrolPoints[0].position;
		currentPoint = 0;
	// Update is called once per frame
	void Update () {
		if (transform.position == patrolPoints[currentPoint].position)

		transform.position = Vector3.MoveTowards(transform.localPosition, patrolPoints[currentPoint].position, moveSpeed * Time.deltaTime);

Hiya, first of all in start you have …

transform.position = patrolPoints[0].position;

If in the inspector, patrolPointsis size 0, then patrolPoints[0] doesn’t exist, thus being out of range exception.

Double check your container in the inspector.

If that is not the case then it is your counter, extending beyon the bounds of your list.