Question by
ColdFrontGames · Apr 09, 2016 at 10:04 PM ·
scripting problem
I am getting an error that doesn't make sense!
using UnityEngine;
using System.Collections;
public class EnemyAI_Test : MonoBehaviour
{
public float fpsTargetDistance;
public float enemyLookDistance;
public float attackDistance;
public float enemyMovementSpeed;
public float damping;
public Transform fpsTarget;
Rigidbody theRigidbody;
Renderer myRender;
void Start ()
{
myRender = GetComponent<Renderer>();
theRigidbody = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
fpsTargetDistance = Vector3.Distance(fpsTarget.position, transform.position);
if (fpsTargetDistance < enemyLookDistance)
{
myRender.material.color = Color.yellow;
lookAtPlayer();
print("Look at Playa Please");
}
if (fpsTargetDistance < attackDistance)
{
myRender.material.color = Color.red;
attackPlease();
print("ATTACK")
}
else
{
myRender.material.color = Color.blue;
}
}
void lookAtPlayer()
{
Quaternion rotation = Quaternion.LookRotation(fpsTarget.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
}
void attackPlease()
{
theRigidbody.AddForce(transform.forward * enemyMovementSpeed);
}
}
The error says:Assets/Editor/EnemyAI Test.cs(38,9): error CS1525: Unexpected symbol `}'
How do i fix this?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612074526im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to Play random animation for Attack 5 Answers
Is this script old o.0? 0 Answers
Vuforia (AR) Play animation on Target Image found (SCRIPT Help) 0 Answers
Why doesnt the value change? 2 Answers
Crouch Script Issue 0 Answers