I have a big sphere and i want to when all objects in this sphere with tag “Path” have PathState == 1 then level has been completed.
You can iterate through all of the objects and check their state
bool isCompleted(){
foreach(GameObject g in GameObject.FindGameObjectsWithTag("Path")){
if(g.GetComponent<YourScriptsName>().PathState != 1){
return false;
}
}
return true;
}
This little bit of code returns true if all objects PathState == 1 and false if one or more objects PathState != 1