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 Galatia410 · Apr 16, 2017 at 07:13 PM · materialparticlescolorrenderermaterial color

Adjust tint color of particles/additive?

Ive been all over google trying to figure out my error with no luck. i have a mesh renderer with a particle/additive material that i am trying to change the tint color of for a fade out. All works good but every now and then im getting the following error in the debugger. not sure how major of a problem it is as it doesnt seam to mess anything up... but lol would like to find a way to stop it if possible. any help would be greatly appreciated, thank you :)

Material doesn't have a color property '_Color'

UnityEngine.Material:get_color()

 public void AttackGroundSlam () {
     GSTime -= Time.deltaTime;
     if (GSTime < .5f) {
         if (!gs) {
             gs = Instantiate (GS, transform.position, Quaternion.identity);
             gs.gameObject.tag = "GS";
             GSR = gs.GetComponent<MeshRenderer> ();

         }
         gs.transform.localScale += new Vector3 (1, 0, 1) * (Time.deltaTime*70);
         if (GSTime < .25) {
             
             float GSTransparency = Mathf.Round(100 * (GSTime / .25f));
             if (GSTransparency < 0) {
                 GSTransparency = 0;
             }
             Debug.Log ("GSTransparency" + GSTransparency);
             GSR.material.SetColor("_TintColor", new Color(GSR.material.color.r,GSR.material.color.g,GSR.material.color.b,GSTransparency));
             if (GSTransparency <= 0) {
                 AttackGSBool = false;
                 Destroy (gs.gameObject);
             }
         }
     }
 }
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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by thetruesthfan · Aug 02, 2018 at 05:10 PM

Hey @Galatia410 ! If you still need an answer for that (probably not because like almost a year passed since then but STILL), then the problem is probably that you wrote, in line 18, "new Color(GSR.material.color.r,GSR.material.color.g,GSR.material.color.b,GSTransparency)" - and what's wrong here is that you wrote "material.color" altho this material has no color - it has TINT color.

To fix it, just write "material.GetColor("_TintColor"); instead!

Hope it helps :D I know it because I ran into the same problem, after previously using this same code for other material that had normal color - and I saw your post several minutes before I understood the problem :D

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 wllmdhn · Mar 21, 2018 at 11:11 PM

Dude! @Galatia410

You just made my day! I was unable to change the TintColor aspect, but thanks to your code it now works! Thanks a million!

Leeghart

ps: I do not know the answer to your question...I do not get the error messages

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

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

Changing two different objects renderer colour 1 Answer

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

Does Material.color, ParticleSystem.startcolor property clones/copies the material? 2 Answers

How Do I Partially Change The Material of An Object On Collision? 1 Answer

MeshRenderer.material.color not changing inside if statement but is outside if statement? 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