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 Goodgab · Mar 28, 2013 at 10:25 PM · javascriptmaterialmaterials

Material rendering black in iOS and Android when assigned in code.

Hi,

I have an array of materials and when I assign one to a plane it's displayed black. This happens only in devices, not on web. The materials are power of 2, and if I assign it in the editor it shows up well in the devices.

Here's my code:

    var tarjetas : Material[];
     
     function Start () 
     { 
          transform.Find("Front").renderer.material = tarjetas[0];
     }

It should be noted that this script is applied to an empty GameObject that has two planes in it (Front and Back);

Any help will be much appreciated. Thanks!

Comment
Add comment · Show 8
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 robertbu · Mar 28, 2013 at 10:26 PM 0
Share

As a starting point, try an alternate shader. I know I've had issues with even simple shaders working in one environment and not in others.

avatar image whydoidoit · Mar 28, 2013 at 10:44 PM 0
Share

You will often see shader errors appearing in the device log if the shader would not compile on the device

avatar image Goodgab · Mar 28, 2013 at 10:53 PM 0
Share

There were no shader errors in the log. Only if I assign them in code they appear black.

avatar image whydoidoit · Mar 28, 2013 at 11:01 PM 0
Share

The log on the device? And have you tried a different shader to rule out the textures etc. Pretty sure my iOS shaders go black if they don't compile - but Unity always puts a log in the XCode console explaining why.

avatar image whydoidoit · Mar 28, 2013 at 11:02 PM 0
Share

You might want to try have something with that shader on it actually in the scene - there might be a problem where it gets optimised out of the build if nothing appears to be using it.

Show more comments

2 Replies

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

Answer by Goodgab · Mar 29, 2013 at 12:16 AM

Turned out the z property of scale in my plane was 0! Changing it to 1 solved the problem.

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 whydoidoit · Mar 29, 2013 at 12:33 AM 0
Share

Glad you found it!

avatar image Goodgab · Mar 29, 2013 at 12:38 AM 0
Share

strange how it worked with the web player and simulator but not the devices...

avatar image
0

Answer by KBAallstar · Jul 13, 2015 at 11:57 PM

I had issues with basic materials turning black on Android. Fixed it by reducing the "smoothness" of the material to 0.5 or less. I also chose compress in ETC1 format, but I think the main issue was smoothness above 0.5. I'm using Unity 5.1.

Comment
Add comment · 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

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

12 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

Related Questions

Re-assigning material on an imported model 1 Answer

change skybox via script help ? 1 Answer

Random Material in specific multiple materials element 1 Answer

Where is the ''extract materials" option? 0 Answers

how to combine either shaders or materials 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