- Home /
Shader for highlighting on mouse over, multiple shaders or property on shader?
I am creating a building game where players can pick up and drop buildings. I am using 2018.1 shader graph. When I move the mouse over (I use Raycast), I want the building to have a glowing edge (Fresnel on emission). I do not want any other properties of the building's material to change.
When not selected, the building is using LightweightPipeline/Standard (Simple Lighting)
and I have set the material base color for each material on the objects. When I programmatically switch shader, then the colors stored in the material are not passed over to the new shader.
I was hoping that I could access the material property "Color" as used in Standard (Simple Lighting) but it appears that the properties of shaders are globally unique and when I create a blackboard property, it creates a new global property rather than reusing an existing one by convention.
Rather than switching between shaders, should I be looking to use one shader and then blackboard properties to switch effects on or off? I've found a few sources that recommend that switching is better but I am trying to share shaders between lots of building objects and I do not want to duplicate them.
Should I manually copy the colours from one shader to another using GetColor(...)
and SetColor(...)
?
Thanks in advance for your help.
Your answer
Follow this Question
Related Questions
Put new Shaders into older version of unity 0 Answers
Is it worth keeping the built-in render pipeline? 0 Answers
How can I edit Material Textures without creating a new Shader?,How to edit Material Texture 1 Answer
a 'bar' or neon like light. 3 Answers
Can't find unlit shader in material shader selection!, 1 Answer