hi ich arbeite gerade an Einem FPS game in Unity und habe das Problem das Error cs 1061 auftritt. und ich verstehe nicht wieso
das ist die Error Meldung
(Assets\Scripts\EnemyManager.cs(20,29): error CS1061: 'GameManager' does not contain a definition for 'enemiesAlive' and no accessible extension method 'enemiesAlive' accepting a first argument of type 'GameManager' could be found (are you missing a using directive or an assembly reference?)
das ist mein Enemy Skript
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class EnemyManager : MonoBehaviour
{
public GameObject Player;
public Animator enemyAnimator;
public float damage = 20f;
public float health = 100f;
public GameManager gameManager;
public void Hit(float damage)
{
health -= damage;
if (health <= 0)
{
gameManager.enemiesAlive--;
Destroy(gameObject);
}
}
// Start is called before the first frame update
void Start()
{
Player = GameObject.FindGameObjectWithTag("Player");
}
// Update is called once per frame
void Update()
{
GetComponent<NavMeshAgent>().destination = Player.transform.position;
if (GetComponent<NavMeshAgent>().velocity.magnitude > 1)
{
enemyAnimator.SetBool("isRuning", true);
}
else
{
enemyAnimator.SetBool("isRuning", false);
}
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject == Player)
{
Player.GetComponent<PlayerManager>().Hit(damage);
}
}
}
danke für die Hilfe