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 Mar 19, 2016 at 03:44 PM by Rickywild.
avatar image
0
Question by Rickywild · Jul 02, 2015 at 10:12 PM · colorcolor changequad

Quad Gradual Colour Change

Hi,

I'm trying to change the colour of a quad, used as background. Specifically I'm attempting to change the colour of each r, g and b values as a Color object incrementally within a Update() method. So far I'm not having much luck. I've noticed the following line of code will change the quads colour accordingly...

 GetComponent<Renderer>().material.color = Color.black;

However if i attempt the following...

     private Color skyColour;
     private float r, g, b;
     
     void Start () 
     {    
         r = 206f;
         g = 140f;
         b = 21f;
 
         skyColour = new Color(r,g,b);
     }
 
     void Update () 
     {
         //skyColour = new Color(r,g,b);
         GetComponent<Renderer>().material.color = new Color(r,g,b);
     }

It doesn't assign the desired colour. Even including alpha values. The colour is set too white. The shader is set to Unlit/Color.

I've breifly looked into solving the problem myself but I figured posting up here might help save time whilst looking into it. Any help would be muchly appreciated

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

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by Dave-Carlile · Jul 02, 2015 at 10:16 PM

So the only time it doesn't give you the color you expect is when you use color attributes you specify? What if you use some of the other standard colors - Color.green, Color.red, Color.yellow, Color.blue... how do those look?

What color space are you rendering in? Although I'm not completely sure if that is only affected by lights, it's worth checking out.

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 Rickywild · Jul 03, 2015 at 09:48 AM 0
Share

Hey Dave, yes. All of the other standard colours work as intended when applied. I had a quick look through the link you gave, and have found what i'm trying to acheive can be done through lighting. Thanks

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

My foreach or the Resources.LoadAll Is not getting the information I need 2 Answers

Image UI color not changing when sprite is set via script 0 Answers

how to change color in unity scripting overtime?,how to change color gradually with C# 2 Answers

Color of some instantiated objects differs from the normal ones. 1 Answer

Changing the color of individual particles 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