Help With My C# Script?

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
	//
	Transform myTransform;
	Rigidbody myRigidbody;
	//
	public Transform moveToObject;
	//
	Vector3 moveToPoint;

	// Use this for initialization
	void Start () {
		myTransform = transform;
		myRigidbody = rigidbody;
		//
		if (moveToObject!= null)
			moveToPoint = moveToObject.position;
	}
	// Update is called once per frame
	void Update () {
		//
		if(moveToPoint !=null)
			MoveToPoint (moveToPoint);
	}
	
	/// <summary>
	/// Sets the point.
	/// </summary>
	public void SetPoint (Vector3 newpoint)
	{
		moveToPoint = newPoint;
	}
	/// <summary>
	/// Sets the point.
	/// </summary>
	public void SetPoint(Transform newTransform)
	{
		moveToPoint = newTransform.position;
	}
	
	/// <summary>
	/// Moves to point.
	/// </summary>
	void MoveToPoint(Vector3 point)
	{
		//
		if((myTransform.position-point).sqrMagnitude < 1)
			return;
		
		Vector3 moveVector = (point-myTransform.position);
		moveVector.Normalize();
		
		myRigidbody.AddForce(moveVector);
		
		//
		myTransform.LookAt(point);
			
	}
}

Assets/Enemy Character.cs(60,9): error CS1525: Unexpected symbol ‘}’

Im only a beginner sorry :slight_smile:

Looks like you’re missing a semi-colon on your last statement.
And try to use code blocks (‘Go Advanced’ then the ‘#’ symbol) when posting source code, it makes it much easier to read.

Thanks :slight_smile: Im getting a new error now though!

Assets/Enemy Character.cs(33,31): error CS0103: The name ‘newPoint’ does not exist in the current context.

Any ideas?

Your function is passed ‘newpoint’ and then you use ‘newPoint’. Case sensitive.