I need to scan through the scene and populate my script component with each material found that uses a particular shader.
What I want to have is a way to easily access each material, for edits / tweaks, in the scene, without having to select on the object or digging through the asset directories to find the materials. A material collector if you will.
you should be able to get a complete list of renderers using FindObjectsOfType()… from there you should be able to access the materials of each, can’t think of anything else that would be using a material…
Yes. But as far as I understand, the OP wanted to not have to click through the inspector to access them. Instead, he/she wants them in one place. But maybe I misunderstood.
Does this have to be in an editor window? Can this be attached to the script on the game object?
I have an empty game object which runs this material collector script, and when I select on this object inside the script panel is where I find all of the materials in the scene using my shader.
If the editor window is the only way to go, I think it will still be effective.
It’s completely up to you whether or not you want it to be an editor window. It all depends on where you want to see this info and when you want to collect the data. Editor windows and inspectors are a great choice because they allow you to use PropertyFields to interact with your materials.