Converting a GameObject to a class?

What I am trying to do is get an array of a class, from calling GameObject.FindGameObjectsWithTag()

Basically this:

PlaceVariables holes = GameObject.FindGameObjectsWithTag(“hole”);

Obviously this doesn’t work, but I dont know how to do it right

Considering you want the PlaceVariables components from all the GameObjects, you’ll need an array of GameObjects to store the data from FindGameObjectsWithTag and an array of PlaceVariables classes. Then you can just populate the array of PlaceVariables by iterating through the array of GameObjects.

GameObject[] gos = GameObject.FindGameObjectsWithTag("hole");
PlaceVariables[] holes = new PlaceVariables[gos.Length];

for (int i = 0;i < gos.Length;i++)  { 
	holes _= gos*.GetComponent(PlaceVariables);*_

Don’t have a chance to test it (and I don’t often code in C#), but I think it’ll work.