Get all Render Objects in our current Scene with code (js)

I’m trying to inspect every gameobject in a scene that has a Mesh Render property. This filter is available using Unity GUI.

In our Lightmapping window, under Object tab if we select Renders we will see in our Hierarchy window only the GO’s with Mesh Render property.

alt text

I want to know how to retrieve these objects dynamically in an array. I want to do this because I’m trying to retrieve the information below from each Render object:

alt text

All these Atlas values of each Static Render Objects are necessary. I wish to somehow store them in an XML or text file so I can later Instantiate these Objects from my Resources folder and then apply them their corresponding Atlas values. (I will later on apply the Lightmap near/far texture to the whole scene by code as well).

I need your help please.

You probably want FindObjectsOfType().

 var renderers = FindObjectsOfType(MeshRenderer) as MeshRenderer[]; 

For disabled objects as well take a look at Resources.FindObjectsOfTypeAll().