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 /
This question was closed May 29, 2017 at 07:41 AM by tanoshimi for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by AndreasX12 · Apr 06, 2013 at 03:26 PM · materialruntimedelaypink

Trying to change texture in Runtime - it becomes pink?

Hi, I'm trying to make some kind of slideshow in unity, but when I run the code, the object becomes pink. here's the code :-)

     public GameObject l;
     
     public Material l1;
     public Material l2;
     public Material l3;
 
     // Use this for initialization
     void Start () {
     l = GameObject.Find("Screen");
     StartCoroutine ("SwitchImage");
     }
     
     
     
     public IEnumerator SwitchImage() {
         print ("1");
     l.renderer.material = l1;
     yield return new WaitForSeconds(1f);
         print ("2");
     l.renderer.material = l2;
     yield return new WaitForSeconds(1f);
         print ("3");
     l.renderer.material = l3;
     yield return new WaitForSeconds(1f);

I have asigned everything and there's no errors in the console..

Thanks, Andreas.

EDIT: If I look at the scene while it's at runtime, it seems like there is no texture at all..? just as if I had deleted it.

Comment
Add comment · Show 5
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 Owen-Reynolds · Apr 06, 2013 at 03:41 PM 1
Share

Does it print 1,2,3? If you select the Screen" object and watch, does the material change?

For fun, test just the new materials: have start just say l.renderer.material = l2; (and don't call the Coroutine.) Does that work?

avatar image AndreasX12 · Apr 06, 2013 at 03:45 PM 0
Share

Yes it says 1,2,3. I can't see the the material on the object while at runtime(just as if it was deleted), but in the Editor/scene the material works as it should. No it doesn't work even when executing the line in the start void and it's still pink when I run the game..

avatar image Owen-Reynolds · Apr 06, 2013 at 04:14 PM 1
Share

If it won't work in Start, focus on that. Changing the material in Start, exactly the way you did, works fine for me.

There's probably something else messing up the material. Could try it in a fresh scene by itself.

avatar image AndreasX12 · Apr 06, 2013 at 04:37 PM 0
Share

Okay, it seems like using gameObject.renderer.material = l1; and put the script on the "Screen" fixed the issue, although some other random texture in my game became pink now (straaange) hehe, Thanks for the help :-)

avatar image admin_8C · May 29, 2017 at 06:34 AM 0
Share

Same issue here and the material is assigned is inspector.

2 Replies

  • Sort: 
avatar image
0

Answer by Bincredible · Apr 07, 2013 at 03:15 AM

Maybe the material or texture you are using is not missing. Because when I have a pink object, it's usually that the material is missing. Make sure that your material is in the inspector and is assigned at all times. :)

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

Answer by admin_8C · May 29, 2017 at 06:34 AM

solution there :

http://answers.unity3d.com/questions/939160/getting-pink-textures-in-build.html

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 ShadyProductions · May 29, 2017 at 07:29 AM 0
Share

why do you pull up a post of 2013

avatar image Owen-Reynolds · May 29, 2017 at 01:38 PM 0
Share

They're trying to be helpful for future users, but don't quite realize how a site like this works. Everyone can do a google Search. If the answer that helped you was on the first few pages there's no need to add a link to it. Everyone else will find it the same way you did.

A funny thing is, that link isn't even the answer. Pink means something is wrong with the material or texture or shader. That linked answer is only for when it works fine but then breaks when you Build it (and that's not even the only reason for that.) But they were trying to be helpful.

Follow this Question

Answers Answers and Comments

13 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

Related Questions

Amplify material editor: adjust property at runtime? 1 Answer

Change 'Color Mask' Property At Runtime 1 Answer

Gameobject goes black when changing material at runtime 0 Answers

Runtime Meshes with Emissive Lighting? 0 Answers

dynamic images for textures ar runtime 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