- Home /
Assign texture to shader bypassing material (in Unity Editor)
There is an option in shader inspector to assign texture to shader. But looks like it doesn't work.
I want to use this Toon Map with this shader in various materials (so I don't want to assign it in each material). Am I doing something incorrectly?
Answer by Joyrider · Aug 16, 2013 at 05:25 PM
These are default (not fallback) values, just like script default values upon class variable declaration.
So it does work, but it works the same way as default values in script. These values only get set on adding the component to an object, not afterwards.
Same goes here, these values only get assigned when you change the shader.
Looks like it works only in some cases: one portion of my materials remains with 'None' map, and others map was updated...
In other words, this option doesn't change the rule that textures go on materials.
It just has the shader fake having it's own texture by saying "hey new material, if you can hear me and don't have a texture, would you $$anonymous$$d using this one?"
a little, but not really, at the moment you choose the shader for your material, the variables for that shader are created. Up untill now, they were left blank. But now, at that moment, they will be assigned those default values.
Don't mistake those default values with fallback values for textures in the shader. It is not because a slot is empty that it will use a texture that was assigned on the shader asset.
The textures assigned on the shader asset will only be assigned to your material at the moment you change the material's shader to that shader.