Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by APProjects · Jan 01, 2013 at 08:11 PM · shaderpost processingimage effectsassign

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
4
Best Answer

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) !

Screenshot of the inspector showing where you have to put default values.


default-inspector-value.png (28.0 kB)
Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image APProjects · Jan 03, 2013 at 07:09 PM 0
Share

Thanks, that's what I needed exactly!

avatar image jayatubi · Nov 28, 2016 at 06:28 AM 0
Share

So how can I make the script to refer to the shader without coding?

avatar image Bunny83 jayatubi · Nov 28, 2016 at 07:12 AM 1
Share

How? Read his last paragraph again, wait 10 seconds and read it again. Repeat until you got it ^^.

avatar image jayatubi Bunny83 · Nov 28, 2016 at 07:17 AM 1
Share

Wow! Thanks! I have never thought the script could be inspected.

Show more comments
avatar image Bunny83 · Nov 28, 2016 at 06:32 PM 1
Share

Thanks for the additional screenshot, i think it should be clear now ^^.

avatar image Dakwamine Bunny83 · Nov 28, 2016 at 08:21 PM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges