- Home /
Accessing a projectors renderer
I am trying to change the materials color of a projector at runtime. I have a series of projectors but I only want to modify the one. If I change the projectors material it changes all the projectors. It seems like I need to access the renderer and change that color instead. I can't seem to find a way to access the renderer on the projector.
I have tried
proj.renderer.material.color = Color.red;
proj.GetComponent( Projector.renderer.material.color = Color.red.
Answer by Eric5h5 · May 26, 2010 at 03:53 AM
Projectors don't have renderers; they project textures onto other objects. You can see in the inspector that there is no renderer component attached to a projector. To change the material, you can instantiate a copy of the material, assign it to the renderer, and change the copy.
Answer by JonManatee · Jun 11, 2010 at 12:15 AM
The problem is that you're using the same material for every projector. Instead, you need to have each projector use a unique material asset. Alternately, if the different settings you have are discrete (like some projectors are red tinted, and they all need to be changed to green tinted), then you could access the materials for each projector and swap the old material out with then new material (in my example you would do something like: projector.material = greenMaterial).
You can get material references to your scripts very easily by having a public material variable and the dragging the reference in through the editor.
Your answer
Follow this Question
Related Questions
Projectors are supposed to go through objects? 1 Answer
I want to create Google Earth style Image Overlays (projections) 0 Answers
Project a solid color onto a game object 1 Answer
Material doesn't have a color property '_Color' 4 Answers
Projector Shader that projects a material with a falloff & alpha 1 Answer