Hey, all,
Is there any way, using C#, I can get Unity to look at every object in the scene?
Like:
foreach ( gameObject GO in Scene )
{
....
}
I realise this is probably a bit of an unusual thing to need to do, but I’m struggling to get my head around how to do it.
Cheers,
SB.
GameObject[] GOs = GameObject.FindObjectsOfType( typeof( GameObject ) ) as GameObject[];
foreach ( gameObject GO in GOs )
{
....
}
Or the same with FindObjectsOfTypeAll which is not documented by the way!
Generally you can use Component.GetComponents(typeof(Transform)); to search all transforms and then use .gameObject on each of them