- Home /
Unexpected symbol error in code
In this following I am receiving an "Unexpected symbol" error and can not find a solution. Assets/Customer Skybox/EnemyAI.cs(24,27): error CS1525: Unexpected symbol `{'
using UnityEngine; using System.Collections;
public class EnemyAI : MonoBehaviour { public Transform target; public int moveSpeed; public int rotationSpeed;
 private Transform myTransform;
 
               void Awake() { myTransform = transform; }
 // Use this for initialization void Start () { GameObject go = GameObject.FindGameObjectWithTag("Player");
      target = go.transform;
 // Update is called once per frame Update () { Debug.DrawLine(target.position, myTransform.position, Color.yellow);
      //look at target
     myTransform.rotation = Quaternian.Slerp(myTransform.rotation, Quaternian.LookRotation(target.position - myTransform.position), rotaionSpeed * Time.deltaTime);
     //move towards target
     myTransform.position += myTransform.forward * moveSpeed *Time.deltaTime;
 }
 } 
Thank you in advance!
Answer by zannghast · Dec 15, 2010 at 09:21 AM
The closing bracket of the Start() function should be written before any function that comes after it (in this case, just before Update):
// Use this for initialization
 
               void Start () {
  GameObject go = GameObject.FindGameObjectWithTag("Player");
 target = go.transform;
 }
 // Update is called once per frame
 Update () {
  Debug.DrawLine(target.position, myTransform.position, Color.yellow);
 //look at target
 myTransform.rotation = Quaternian.Slerp(myTransform.rotation, Quaternian.LookRotation(target.position - myTransform.position), rotaionSpeed * Time.deltaTime);
 //move towards target
 myTransform.position += myTransform.forward * moveSpeed *Time.deltaTime;
 } 
Answer by RobF · Dec 15, 2010 at 09:26 AM
You're missing a }
void Start () { GameObject go = GameObject.FindGameObjectWithTag("Player");
    target = go.transform;
}
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                