How can I fix this error? I did not find anything on the internet ... this is the script
'using UnityEngine; using UnityEngine.AI;
public class BlueCubeBehaviour: MonoBehaviour {
private Rigidbody BlueCubeMovement;
private NavMeshAgent FollowPlayer;
public Transform PlayerPosition;
private Renderer Appearance;
private bool ActiveNavMesh;
float Velocity = Random.Range(2.5f, 5.8f);
void Start()
{
ActiveNavMesh = false;
tag = "YellowEnemyCube";
float ScaleOfCube = Random.Range(1.0f, 3.8f);
BlueCubeMovement = GetComponent<Rigidbody>();
Appearance = GetComponent<Renderer>();
FollowPlayer = GetComponent<NavMeshAgent>();
Appearance.material.color = Color.blue;
transform.localScale = new Vector3(ScaleOfCube, ScaleOfCube, ScaleOfCube);
BlueCubeMovement.mass = Random.Range(1.0f, 15.0f);
}
void Update()
{
if (ActiveNavMesh == true) {
FollowPlayer.destination = PlayerPosition.position;
FollowPlayer.velocity = new Vector3(Velocity, Velocity, Velocity);
}
}
private void OnCollisionEnter()
{
if (BlueCubeMovement.angularVelocity == new Vector3(0, 0, 0)) {
ActiveNavMesh = true;
}
}
private void OnCollisionStay()
{
if (BlueCubeMovement.angularVelocity == new Vector3(0, 0, 0)) {
ActiveNavMesh = true;
}
}
} 'this script is in a cube ... and enjoy the following error