- Home /
Need to modify material/shader for all objects
Hi,
I'm extremely new to Unity and have a need to modify the shader for all objects in a scene, regardless as to whether the objects are loaded in memory. Basically, I'm writing an IR implementation that can be toggled between IR and non-IR views. I've seen the function, GameObject.FindGameObjectsWithTag, and think that might be able to help me. However, I don't know what tag to use in order to get all objects (sky, terrain, models, foliage, etc.)
I know that this is a relatively expensive operation, and trust me, this won't be done every frame. :)
Any pointers/tips would be most appreciated, providing of course, this is even possible.
Thanks, Brian
If the help on the forum solved your problem you should mark the answer as correct, so that other people can see that there is a solution in this thread. It is good conduct at least.
Not sure how to do that. Clicked the thumb up icon, but I was told I "don't have permission to do this action".
Answer by Paulo-Henrique025 · Aug 18, 2012 at 02:44 AM
I think this it:
foreach(GameObject go in GameObject.FindObjectsOfType<GameObject>())
{
//Do your stuff
}
Thanks. Finally got around to looking at this in depth. Turns out the FindObjectsOfType parameter should be FindObjectsOfType(typeof(GameObject))
Your answer
![](https://koobas.hobune.stream/wayback/20220613075826im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why are most of my materials displayed as black or transparent? 1 Answer
What is the difference between per-Renderer and per-Material property block? 0 Answers
How can I duplicate the Amplify Shader Editor hologram simple shader? 0 Answers
Blending text and materials on a single plane/mesh 0 Answers
Two textures one Material 0 Answers