Hey Guys! I’m a bit stuck here. I’ve a List through which I’m looping and checking to see whether the object I’ve send through the argument is active or not. If not I’m activating it.
But what I want is to check whether the gameObject with the same name as I’m sending to it is active or not. Is there a way I can do this or not.
Here is my code:
public GameObject activateObstacle(int id, string name){
for (int i = 0; i < obstaclePool[id].Count; i++)
{
if(!obstaclePool[id]*.activeInHierarchy)*
-
{*
_ obstaclePool[id].SetActive(true);_
_ string spawnedObstacleName = obstaclePool[id].gameObject.name;_
* Debug.Log("spawned obstacle name is " + spawnedObstacleName);*
_ return obstaclePool[id];
* }
}
}*
I want to check whether spawnedObstacleName is similar to the name parameter that I’m sending. And If it is same then do all the stuff like checking whether it is active or not and then activating it.
Please Help. Thank you._