Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
9
Question by daemionx · Sep 20, 2013 at 12:24 AM · shaderscompile

How Can I Avoid Full Shader Recompilation?

I've decided to move some common features from our shaders into some cginc headers to avoid duplication. Whenever I make a change to any include file that has been included by any shader, every single shader in the project gets recompiled (this takes ~5 minutes). The problem is compounded by the difficulty to figure out what compile errors mean and fixing one triggering another. I've started simply creating all the functionality for a cginc file in the shader it will be used in, then moving it the cginc file to only incur the long compile time once (hopefully).

Is there any way to avoid this or any better approach to avoiding code duplication in shaders? It only happens if I actually #include the cginc file in a shader in the project (just having a cginc file in the project hierarchy somewhere doesn't trigger a recompile).

As a side note, modifying a shader that has included one of these custom cginc files does not trigger a recompile of anything except for the individual shader I'm modifying.

Comment
Add comment · Show 3
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 stevesan · Apr 27, 2014 at 06:08 PM 0
Share

Bump...this is very confusing. When does Unity recompile shaders?

avatar image Benproductions1 · Apr 28, 2014 at 05:13 AM 0
Share

@stevesan, ins$$anonymous$$d of posting a useless comment, it would be more beneficial if you actually up-voted the question. The more votes a question has, the higher the likelihood of it being seen. If you just post "bump" type comment, you're not really helping.

avatar image stevesan · Dec 09, 2014 at 07:55 PM 0
Share

ok i upvoted

0 Replies

· Add your reply
  • Sort: 

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

18 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Acessing Shader Properties in a object that has two materials 1 Answer

Light Projection 1 Answer

How to apply a color to the second texture in this shader? 1 Answer

GrabPass and transparent Queue materials 0 Answers

Best way to achieve a vector graphics effect? 2 Answers


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