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
1
Question by dorpeleg · Mar 23, 2013 at 03:22 PM · shadermaterialcoloritweenfade

Material doesn't have property '_Color'

Hello everyone.

I'm having a really weird problem.

I have a character that has skinned mesh renderer and on the hand bone I have a gun with a mesh renderer.

I also have two particle systems under the parent gameobject.

I'm using iTween.FadeTo to fade all children of the gameobject (character & gun), and it works perfectly.

Both the character and the gun start with the default diffuse shader.

Before I use the iTween.FadeTo, I'm changing their shaders to a shader That I found that can fade.

But for some reason I'm getting this error:

Material doesn't have a color property '_Color'

From the iTween script.

Any ideas?

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

4 Replies

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

Answer by nsxdavid · Mar 23, 2013 at 03:51 PM

The Shader used by the material doesn't have a property named _Color. Edit the shader to see how it works and what the internal property names are. They might have a color property but named it differently. Refactor to use the magic name _Color in the shader script to get it to work from iTween.

Comment
Add comment · Show 3 · 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 dorpeleg · Mar 23, 2013 at 04:26 PM 0
Share

As I said, The fading works.

The shader I'm using to fade the object does have the _Color property.

That's way I don't it's weird.

avatar image nsxdavid · Mar 23, 2013 at 04:40 PM 0
Share

One thing to try is to modify iTween so that that error message gives you more information, like what gameObject / $$anonymous$$aterial it is not happy about.

avatar image dorpeleg · Mar 23, 2013 at 05:14 PM 1
Share

I'm not sure how to do that.

Can you help?

edit:

Ok, so I figuerd out what is giving the errors.

It's the particle systems.

I didn't know iTween will try to effect them as well.

Thanks for your help.

avatar image
0

Answer by robertbu · Mar 23, 2013 at 04:10 PM

If you select the material in the Project pane, what properties does it show for the material? You may have to double click on the material header in the inspector to get it to open. iTween works with Main Color. Not all shaders have a Main Color (which is named _Color in the shader). So the solution is to switch to a different shader.

I'm not sure if/how iTween handles objects with multiple materials. It is possible there are multiple materials on the gun, and only some of them lack a _Color property.

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 dorpeleg · Mar 23, 2013 at 04:29 PM 0
Share

As I said, The fading works.

The shader I'm using to fade the object does have the _Color property.

All the objects have only one material.

It's like there is a hidden gameobject, But I checked, there isn't one....

avatar image
0

Answer by maaton · Nov 25, 2014 at 04:31 PM

By default iTween is trying to apply FadeTo() to the materials of the 2 children particleSystems as well, that's why you're getting this error. If you want to use ColorTo() or FadeTo() on a gameObject that is parent of any other gameobjects that have shaders without _Color property make sure you pass "includeChildren",false to the targeted gameObject as a tween parameter.

iTween.FadeTo(gameObject,iTween.Hash( "alpha", targetAlpha, "time",animTime, "includeChildren",false));

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 Apoll0 · May 04, 2016 at 07:35 AM

Hello, @dorpeleg! You can try to edit the iTween's code, where:

 if(target.GetComponent<GUITexture>()){
             tempColor=fromColor=target.GetComponent<GUITexture>().color;    
         }else if(target.GetComponent<GUIText>()){
             tempColor=fromColor=target.GetComponent<GUIText>().material.color;
         }else if(target.GetComponent<Renderer>()){
             tempColor=fromColor=target.GetComponent<Renderer>().material.color;
         }else if(target.GetComponent<Light>()){
             tempColor=fromColor=target.GetComponent<Light>().color;
         }

to

 if(target.GetComponent<GUITexture>()){
             tempColor=fromColor=target.GetComponent<GUITexture>().color;    
         }else if(target.GetComponent<GUIText>()){
             tempColor=fromColor=target.GetComponent<GUIText>().material.color;
         }else if(target.GetComponent<Renderer>() && target.GetComponent<Renderer>().material.HasProperty("_Color")){
             tempColor=fromColor=target.GetComponent<Renderer>().material.color;
         }else if(target.GetComponent<Light>()){
             tempColor=fromColor=target.GetComponent<Light>().color;
         }

So, here you are checking the availability of "_Color" property

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

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

Changing two different objects renderer colour 1 Answer

How do I change GL LINES color? 1 Answer

Shader to partially ignore lighting (Specific colors) 0 Answers

Particle system fine in Editor but Wrong in android build 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