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
0
Question by highpockets · Oct 14, 2015 at 05:04 PM · colormeshfiltercolorsvertex color

mesh.colors doesnt seem to work at the moment

I have used this same code in another script and it works, but this is not working for some reason.

Here is the script:

IEnumerator FlashYellow() {

         print ("Here We are");
         print ( touchedObj.name );
         var objMF = touchedObj.GetComponent<MeshFilter>();
         var colors = new Color[ objMF.mesh.vertexCount ];
 
         while( isFlashing )
         {
 
             print ("okok");
             for(var i = 0; i < colors.Length; i++)
             {
                 print ("YO" );
                 colors[i] = new Color(234/255.0f, 83/255.0f, 57/255.0f, 0);
             }
 
             objMF.mesh.colors = colors;
 
             yield return new WaitForEndOfFrame();
         }
     }


All of the prints are showing up the in the console... I'm sure I'm goofing something up, but like I said, I have used this code with another script and it works fine, it just wasn't an IEnumerator in the other script. I have changed the colour multiple times and I have used it on a prefab and just a regular cube and neither works. The code should simply change the vertex colours and it doesn't. At the moment it is locked in the while loop, but that shouldn't affect wether the colour shows either..

I'm lost, any help would be appreciated.

Comment
Add comment · Show 4
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 highpockets · Oct 14, 2015 at 05:25 PM 0
Share

I threw in:

 print (obj$$anonymous$$F.mesh.colors[1]);

And it shows the correct colour output, but why doesn't the object change colour??

avatar image highpockets · Oct 14, 2015 at 05:54 PM 0
Share

Oh, it might be that the shader I'm using doesn't support vertex colours.. $$anonymous$$aybe I just solved this

avatar image highpockets · Oct 14, 2015 at 06:04 PM 0
Share

No luck. Someone please help

avatar image Cherno highpockets · Oct 14, 2015 at 06:18 PM 0
Share

I stil believe your shader is the problem. Try it with one that definitely supports vertex colors.

1 Reply

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

Answer by dudester · Oct 14, 2015 at 10:54 PM

In shader use o.albedo = IN.colors and under input put color : Colors ; that will make it use mesh colors as a texture for the mesh.

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 highpockets · Oct 15, 2015 at 11:37 AM 0
Share

Ya, I'm shader traded alright. I made a shader a long time ago for this, but I forgot all about it. Thanks dudester and cherno..

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

31 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 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 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

Using predefined colors vs defining new colors 1 Answer

Legacy animation system cannot animate colors? 3 Answers

Convert RGB to RYB color scheme? 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