Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 MindForkApps · Oct 10, 2015 at 12:48 AM · buildlinerenderer

LineRenderer doesn't work in build

In the Unity Editor the Line Renderer component works perfectly fine and renders just as it should do but when it is built for Android then they disappear.

The material for the Line Renderer uses the Mobile/Particles/Additive shader

My code for the Line Renderer is here: string line;

             StreamReader theReader = new StreamReader (fileName, Encoding.Default);
 
             using (theReader) {
                 do {
                     line = theReader.ReadLine ();
 
                     file.Add (line);
 
                     if (line != null) {
                         string[] entries = line.Split ('>');
 
                         int firstNode = int.Parse (entries [0]);
                         int secondNode = int.Parse (entries [1]);
 
                         LineRenderer renderer = nodes [firstNode].GetComponent <LineRenderer> ();
 
                         renderer.SetPosition (0, nodes [firstNode].transform.position);
                         renderer.SetPosition (1, nodes [secondNode].transform.position);
                     }
                 } while (line != null);
 
                 theReader.Close();
             }
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 paraself · Oct 10, 2015 at 10:56 AM 0
Share

Did you double checked that the shader is successfully loaded in the built player? Try adding that shader to the preloaded shader variant collection which is under Graphics setting.

avatar image fafase · Oct 10, 2015 at 01:58 PM 0
Share

Docs says:

Note that a shader might be not included into the player build if nothing references it! In that case, Shader.Find will work only in the editor, and will result in pink "missing shader" materials in the player build. Because of that, it is advisable to use shader references ins$$anonymous$$d of finding them by name. To make sure a shader is included into the game build, do either of: 1) reference it from some of the materials used in your scene, 2) add it under "Always Included Shaders" list in ProjectSettings/Graphics or 3) put shader or something that references it (e.g. a $$anonymous$$aterial) into a "Resources" folder."

So:

  mat.shader = Shader.Find("$$anonymous$$yShader");

Unity does not find the reference there.

 public Shader myShader;

 mat.shader = myShader;

Unity has a reference from the variable so it will add it to the build.

http://docs.unity3d.com/ScriptReference/Shader.Find.html

avatar image MindForkApps · Oct 11, 2015 at 01:51 PM 0
Share

Thanks for your solutions @paraself and @fafase but unfortunately none of them worked. Any other ideas? It's not that the Line Renderer renders pink, "missing shader" lines but it simply doesn't render them at all

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Line Renderer not showing in Builds (Standalone, Mobile and Web) 0 Answers

Linerenderer pink and not working after build .exe 1 Answer

Can't Build PC Standalone due to multiple namespace script errors but playable in editor 1 Answer

Setting default quality level for WebGL Build not working 0 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