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
3
Question by blitzen · Mar 01, 2012 at 02:21 AM · shaderwebplayer

Shader Missing in Builds When Called From Shader.Find("")

I have a script that draws up a reference to a shader by name via Shader.Find(), and it displays fine in the editor, yet when I build it for the web player OR standalone PC the object displays in solid pink. Thus it appears that the builder doesn't know it needs to be included in your build. Is there a way to mark it to be force-included?

Comment
Add comment · Show 2
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 blitzen · Mar 01, 2012 at 03:07 AM 0
Share

(I tried to edit the question with this new realization but it seems the forum is broken and won't apply editing changes.)

I have a script that draws up a reference to the shader by name via Shader.Find(), and so that is the only reference to it from the program - thus it appears that the builder doesn't know it needs to be included in your build. Is there a way to mark it to be force-included?

avatar image flamy · Mar 01, 2012 at 03:30 AM 0
Share

keep ur shader in resource folder it will be included no matter wat happens

3 Replies

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

Answer by Eric5h5 · Mar 01, 2012 at 03:17 AM

Nothing to do with 3.5; the shader needs to be included somehow that forces it to be part of the build. It's in your project, so it will always work in the editor. Finding things with strings won't do it, since it's very hard to tell what all possible combinations are. i.e., Shader.Find("foobar"); could be done as var a = "foo"; var b = "bar"; Shader.Find(a+b);. So Shader.Find won't cause a shader to be included, since Unity doesn't know it's being referred to. Instead, use the shader in a material on some object that's in the scene, or use it in a material that's in the Resources folder, since everything in Resources is always included whether it's used or not.

Comment
Add comment · Show 1 · 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 blitzen · Mar 01, 2012 at 03:32 AM 0
Share

Looks like we were posting answers at the same time. Good call.

avatar image
7

Answer by blitzen · Mar 01, 2012 at 03:20 AM

Solved as per a related post by placing the shader asset in Assets/Resources, which ensures it gets included in builds even when not directly linked to.

Comment
Add comment · Show 2 · 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 shavais · May 02, 2013 at 01:08 PM 0
Share

Where are the built-in shader assets? Can you get at them without downloading their source code?

The way I typically get built-in shaders into my project is by assigning them to materials that I don't actually use, and them putting those materials into a Resources folder. There must be a better way?

avatar image blitzen · Jul 29, 2013 at 04:06 AM 0
Share

Shavais: Not that I know of. Both for built-in shaders and built-in GUI skins, you seem to have to download them separately. A slight inconvenience, yes.

avatar image
3

Answer by jethrogillgren · Feb 08, 2018 at 06:40 PM

The new answer for Unity 2017:

Shaders can be forced included using Project Settings>Graphics>"Always Include Shaders"

Comment
Add comment · Show 1 · 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 SimRuJ · Jul 26, 2021 at 11:31 AM 0
Share

In Unity 2021 you can get there through: Edit>Project Settings>.... Or also: File>Build Settings>Player Settings>Graphics>Always Included Shaders (increase the size and pick the shader for the new element)

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

9 People are following this question.

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

Related Questions

Why won't my specular shaders work in the WebPlayer? 0 Answers

What is the most common shader model (2.0+,3.0+,4.0+) for unity web player users (or an average) 1 Answer

How to force the compilation of a shader in Unity? 5 Answers

Only on Mac OSX: Rendering/shader error within webplayer 0 Answers

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 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