• 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
2
Question by Brainrush1 · Oct 10, 2015 at 01:38 AM · erroruieditorcanvascolor

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

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
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 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, $$anonymous$$ike.

-Pablo Leon-Luna

avatar image
0

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

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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

45 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

Related Questions

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

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

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

Error 0xc000007b when starting unity instaler 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges