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
0
Question by manhtien2607 · Dec 06, 2012 at 03:28 AM · shaderiosmaterialbugcolor

iOS simple shader does not work

Hi

I have been on this for days without any ideas come up. I wrote a very simply shader to draw a line using vertex.

Shader "Custom/LineShader" {

Properties { _Color ("Color", Color) = (1, 1, 1) }

SubShader { Color[_Color] Pass{} } }

And instantiate material with this shader

lineRenderer = line.AddComponent(LineRenderer);

var lineShader = Shader.Find("Custom/LineShader");

var lineMaterial = new Material(lineShader);

lineRenderer.material = lineMaterial;

lineRenderer.material.color = color;

These code work well on Editor (even with iOS platform switched on) but when deploying on iPad, all the line is just black no matter color i tried to set, i attach debugger and dont find any color property of this material. What happen? i think it should be very simple but it is not. Any recommendation would be so helpful now because i really out of idea. Thanks

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
0

Answer by Eric5h5 · Dec 06, 2012 at 04:15 AM

Unity does not include any resources that are not directly referenced, but referencing them by code doesn't count since there is no good way for Unity to tell. So you need to have the shader be used in a material that's used on an object in the scene, or else put the shader in the Resources folder, since everything in Resources is included in a build regardless of whether it's directly referenced or not.

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 manhtien2607 · Dec 07, 2012 at 02:47 AM 0
Share

Yes, i have already placed the shader in Resources folder, it is strange that everything works fine in Editor or Desktop build but iOS. I attached debugger and see that in Desktop build, material that used this shader has color and texture properties (even i dont define texture it in shader file), in iOS there is nothing in material. I think in Desktop build it is default that any material will have some essential properties but iOS it is not support, and i need to rewrite an relevant shader that has color property to set. the matter here is i dont know where is the error of my simple shader.

avatar image manhtien2607 · Dec 07, 2012 at 03:27 AM 0
Share

Thanks for your suggest, i remove my shader (which is on resource folder already) , import built in mobile vertex color shader of Unity, move shader file from standard folder to Resource (i tried it before but did not copy to Resources and it null on iPad) and voila :) Thanks again. You made my day.

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

Material doesn't have a color property '_Color' 4 Answers

Changing two different objects renderer colour 1 Answer

See through issue in iOs 0 Answers

Materials are colored differently on rotated objects 1 Answer

UI Triangle Color picker 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