This question was
closed Apr 10, 2016 at 10:17 AM by
meat5000 for the following reason:
Not enough information
Question by
Vakoss45 · Apr 10, 2016 at 09:46 AM ·
gameobjecttagsphere
GameObject Tags
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.
Comment
Best Answer
Answer by jni97 · Apr 10, 2016 at 10:04 AM
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
Follow this Question
Related Questions
instantiate prefab at every gameobject with tag 0 Answers
Stop a game object from following an untagged object. 1 Answer
How to become invincible towards enemies when powerup is active 2 Answers
How to put ".transform" after "GameObject.FindGameObjectsWithTag()" 1 Answer
Create an object on mouse click? 0 Answers