• 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 /
  • Help Room /
avatar image
Question by Brainrush1 · Oct 10, 2015 at 01:38 AM · uierroreditorcanvascolor

Canvas Error - Everything tinted blue

So whenever I play this scene in the editor - or in the built version, I open up a canvas object and all of a sudden everything in the canvas gets tinted blue. But then when I goto other scenes, all the canvases there are tinted blue as well. It does not reset until I quit and reopen Unity. It is triggered when a certain panel in enabled in just this one scene but affects the rest of the canvases in the project. Any ideas? I am on the latest version of Unity, 5.2.1f1

In the picture below, notice how yellow text appears dark blue.

alt text

screen-shot-2015-10-09-at-62813-pm.png (448.7 kB)
Comment
MikeChurvis
schysoid

People who like this

2 Show 0
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

  • Sort: 
avatar image

Answer by MikeChurvis · Mar 06, 2016 at 02:49 AM

@Brainrush1 Howdy! Not sure if you're still having this issue, but the same thing just happened to me. Somewhere in a script, I had done this:

 void SetColor(Color newColor)
 {
     canvasElement.material.color = newColor;
 ...
 }

The problem with this is twofold:

  1. Canvas elements have a default shared material called "none" (yes, "none" is an actual material, not the absence of one). When you modify canvasElement.material.color you're changing the "none" material's color, meaning you're changing the color of every canvas element with the "none" material.

  2. This change persists even after you've quit out of the game, meaning it doesn't automatically reset like most other in-game changes do.

To fix this,

  1. Comment out or Remove any code that's similar to the problem code above (tip: Command/Control + F for "material.color").

  2. put this C# script on an empty gameObject in the scene:

     using UnityEngine;
     using UnityEngine.UI;
     public class MaterialFixer : MonoBehaviour
      {
        // When the game starts,
        void Awake()
        {
          // Add an Image component to this GameObject
          Image canvasElement = gameObject.AddComponent<Image>();
          // and change the Image's material, shared between all canvas elements, back to white.
          canvasElement.material.color = Color.white;
        }
      }
    
    
  3. Hit the Play button. The color of all Canvas elements should return to normal and stay that way. You can now safely remove the script.

Let me know if this helps, or if you have any other issues. Cheers!

- Mike Churvis

Comment
ThaiCat
changled
Horschty
schysoid
Irrgeist

People who like this

5 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 paleonluna · Mar 09, 2016 at 11:54 PM 0
Share

Thanks for the thorough response, as it turns out, the default material on the canvas was being set by some script an old coworker had written - took away that script and everything was ok. Thanks a lot though, Mike.

-Pablo Leon-Luna

avatar image

Answer by AmirMM_333 · Dec 20, 2019 at 12:44 PM

Just right click on the "Default UI Material" and select Reset. done.

Comment

People who like this

0 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

44 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

Related Questions

Unable to create a coloured mesh on a canvas. 1 Answer

How can I change the UI button color when clicked 1 Answer

Working with UI makes both editor and game view jump between 1x and 2x scale. 1 Answer

Canvas is scaling in the editor but not in the build 1 Answer

UI elements inactive after activation from their parent 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