O error no console:
Assets\Scripts\ControlaInimigo.cs(43,38): error CS1061: 'Animator' does not contain a definition for 'setBool' and no accessible extension method 'setBool' accepting a first argument of type 'Animator' could be found (are you missing a using directive or an assembly reference?)
meu codigo:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ControlaInimigo : MonoBehaviour
{
public GameObject Jogador;
public float Velocidade = 5;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void FixedUpdate()
{
float distancia = Vector3.Distance(transform.position, Jogador.transform.position);
Vector3 direcao = Jogador.transform.position - transform.position;
Quaternion novaRotacao = Quaternion.LookRotation(direcao);
GetComponent<Rigidbody>().MoveRotation(novaRotacao);
if (distancia > 3)
{
GetComponent<Rigidbody>().MovePosition
(GetComponent<Rigidbody>().position +
direcao.normalized * Velocidade * Time.deltaTime);
GetComponent<Animator>().setBool("Ataque", false);
}
else
{
GetComponent<Animator>().setBool("Ataque", true);
}
}
}
Por favor alquem me ajuda!!