- Home /
Parsing Error
using UnityEngine;
using System.Collections;
public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
// Use this for initialization
void Start () {
GameObject go = GameObject.FindGameObjectWithTag("Player");
target = go.transform;
}
// Update is called once per frame
void Update () {
Debug.DrawLine(target.position, myTransform.position, Color.yellow);
//Look At Target
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
//Move Towards Target
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
It's on the line after //Move Towards Target myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
I have a problem too it's also a parsing problem in unity can you help me i'm a beginner so i'm not very smart at this area. i have error assets/testing.cs(17,9): error CS8025: Parsing error this is the code:
using UnityEngine; using System.Collections;
public class Testing : $$anonymous$$onoBehaviour {
// Use this for initialization void Start () { }
// Update is called once per frame void Update () { if(Input.Get$$anonymous$$eyUp($$anonymous$$eyCode.Space)) { gameObject.transform.up.y = +1 ; } } Thanks in advance Paul
PS: I'm Dutch so sorry if i have some write errors
Answer by Styn · Aug 04, 2011 at 12:37 PM
You don't have a closing bracket for your class! (assuming this is the full code) You should try to provide more details about the error
Ok, i added a closing bracket for my class but then I get an error that says "namespace can only contain types and namespace declarations " on lines 11 and 17 (the void Start and void Update lines)
Answer by dibonaj · Aug 04, 2011 at 01:53 PM
You need to have closing braces for your class and you need to declare myTransform.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
C# Errors CS1525,CS8025 2 Answers
Distribute terrain in zones 3 Answers
Parsing error. No idea what it is or what the problem is. 2 Answers
Switch statement error 1 Answer