Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 post has been wikified, any user with enough reputation can edit it.
avatar image
1
Question by Raynoko · Aug 17, 2014 at 02:10 PM · shadergameobjectrenderingmaterialcolor

Material doesn't have a color property '_Color'

Hi, my console write me this error: Material doesn't have a color property '_Color' UnityEngine.Material:get_color() material_switch:Start() (at Assets/Scripts/CS script/material_switch.cs:14) But i dont know what is it. Any idea how to fix it? here is my source code:

 using UnityEngine;
 using System.Collections;
 
 public class material_switch : MonoBehaviour {
     
     public Material original_material;
     public Shader original_shader;
     public Color original_color;
     public Material edit_material;
 
     public void Start () {
         original_material = transform.renderer.material;
         original_shader = transform.renderer.material.shader;
         original_color = transform.renderer.material.color;
     }
 
     public void restoreMaterial() {
         transform.renderer.material = original_material;
         transform.renderer.material.color = original_color;
         transform.renderer.material.shader = original_shader;
     }
 
     public void saveMaterial() {
         original_material = transform.renderer.material;
         original_shader = transform.renderer.material.shader;
         original_color = transform.renderer.material.color;
     }
     
     public void setEditMode() {
         transform.renderer.material = edit_material;
         transform.renderer.material.shader = Shader.Find ("Diffuse");
         transform.renderer.material.color = new Color32(72,114,19,255);
     }
     
     
 
 }

Thanks

Kind regards Thomas

Comment
Add comment · Show 1
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 meat5000 ♦ · Aug 17, 2014 at 11:17 AM 0
Share

To copy and paste this script to my editor reproduces no errors.

$$anonymous$$ake sure your gameobject actually has a material assigned.

2 Replies

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

Answer by robertbu · Aug 17, 2014 at 02:14 PM

Not all shaders support main color. First check the material. You should see a color selection tool on the right and on the left you will usually see "Color" or "Main Color". If your material does have a color selection box, then it does not support color. If you have a selection box, open the shader and see if that color is named _Color.

Only a fraction of the shaders that ship with Unity have 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 Raynoko · Aug 18, 2014 at 07:06 AM 0
Share

yes, i know that yet :D i had a lot of free time fot this problem, and i solved that :) but so thnaks for your time and helpful message.

avatar image
0

Answer by OZAV · Jul 09, 2016 at 07:35 AM

As many will still bump into this thread (and no threads on Unity issues will ever be old):

-Just try using some of shaders under: Particles - "Additive" or any of them, in the particles-"additive" list of shaders ...

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

4 People are following this question.

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

Rendering problem with opaque objects with the same Mat rendering through each other (Grouped to the same empty object) 0 Answers

Rendering problem for objects with low y position 0 Answers

Shader renders sprite imprecisely 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