Hello, i have this script that works perfectly with the deprecated FindObjectsOfType<>(); I am in Unity 2023.1
using System.Collections.Generic;
using UnityEngine;
public class ManagerNiveau : MonoBehaviour
{
public static ManagerNiveau instance;
private void Awake()
{
instance = this;
}
public bool niveauActif;
private VieChateau cechateau;
public List <VieEnnemi> ennemisactifs=new List<VieEnnemi>();
private VaguesEnnemis [] mesVagues; // nouvelle variable qui va regarder nos vagues d'ennemis
void Start()
{
cechateau=FindFirstObjectByType<VieChateau>();
niveauActif = true;
ManagerSons.instance.JoueBGmusique();
mesVagues= FindObjectsOfType<VaguesEnnemis>(); // associe aux bons objets avec les bons scripts
}
void Update()
{
if(niveauActif)
{
if(cechateau.vieActuelle <=0)
{
niveauActif = false;
UIController.instance.ecranperdant.SetActive(true);
}
bool vaguesCompletes = true; // un booléen qui détecte si nos vagues sont complétées
foreach(VaguesEnnemis monspawn in mesVagues) //pour chaque spawner
{
if(monspawn.vaguesacreer.Count > 0) // tant qu'il y a des vagues Ă venir
{
vaguesCompletes = false; // nos vagues ne sont pas complétées
}
}
if(ennemisactifs.Count ==0 &&vaguesCompletes) // on ajoute le fait que les vagues sont complétées
{
niveauActif = false;
UIController.instance.ecrangagnant.SetActive(true);
}
}
}
}
On line 22, when i try to convert mesVagues= FindObjectsOfType();
BY
mesVagues= FindObjectsByType(); i have error C1501, it needs another parameter in the parenthesis but i have no idea what to put there. The documentation makes me a little confuse there.
Anyone who knows what i must put in the parameter? It worked perfectly with FindFirstObjectByType but not with FindObjectsByType. Why?
Thanks for your help