- Home /
How Unity assigns image effect shaders to their scripts automatically?
I don't understand, how it does, and I can I do it. I wrote some post processing shaders and I need them to automatically assign by script.
It is really annoying if I have to remove a script because of reordering, I also need to select the shader to it.
I know about "Shader.Find", but how should I use it? I want to auto-assign the shader as I add the image effect script component to my camera game objects (as how it works with image effects come with Unity)
I'm using Unity 3.5 Pro.
Answer by Dakwamine · Jan 01, 2013 at 09:08 PM
In fact, Unity doesn't do anything to assign automatically. In fact, when you import a MonoBehaviour script from the Image Effects package, these scripts keeps references to a specific shader defined before they were put in the package.
If you want to reproduce this, you have to reference your shader file in a shader field of your MonoBehaviour script, the script file itself (you know, select the script file and you will see some default properties in the inspector) !
So how can I make the script to refer to the shader without coding?
How? Read his last paragraph again, wait 10 seconds and read it again. Repeat until you got it ^^.
Wow! Thanks! I have never thought the script could be inspected.
Thanks for the additional screenshot, i think it should be clear now ^^.
Yup! I was kind of free today so I decided to do some wandering around the Unity kingdom after a few years (metaphorically) abroad. And thanks for answering. ^^
Your answer
Follow this Question
Related Questions
In FastBloom(Bloom Optimized) shader, what's the difference between Standard and Sgx blur type? 0 Answers
Variable not Assigned 1 Answer
How do I assign a script to a clone through another script? 1 Answer
Scripting Shader: How to control Alpha with slider? 1 Answer
Screen shaders that alter geometry at runtime or through camera 1 Answer