My game was working fine. Then one time I open it after making no changes. The game here are the errors:
Assets/Enemy.js(11,11): BCE0044: expecting (, found ‘Start’.
Assets/Enemy.js(11,18): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Enemy.js(16,11): BCE0044: expecting (, found ‘Update’.
Assets/Enemy.js(16,20): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Enemy.js(24,11): BCE0044: expecting (, found ‘OnTriggerEnter’.
Assets/Enemy.js(24,26): BCE0043: Unexpected token: Trigger.
Assets/Enemy.js(24,45): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Enemy.js(29,1): BCE0044: expecting }, found ‘’.
Here is the code:
#pragma strict
var target : Transform;
var moveSpeed = 3;
var rotationSpeed = 3;
var myTransform : Transform;
function Awake() {
myTransform = transform;
function Start() {
target = GameObject.FindWithTag("Player").transform;
};
function Update () {
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
transform.position.y = 1;
};
function OnTriggerEnter(Trigger : Collider) {
if(Trigger.tag == "Player") {
Application.LoadLevel(2);
};
};