- Home /
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.
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:
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.
Answer by robertbu · Jun 07, 2013 at 07:01 AM
You probably want FindObjectsOfType().
var renderers = FindObjectsOfType(MeshRenderer) as MeshRenderer[];
For disabled objects as well take a look at Resources.FindObjectsOfTypeAll().
Your answer
![](https://koobas.hobune.stream/wayback/20220613103659im_/https://answers.unity.com/themes/thub/images/avi.jpg)