- Home /
Text Changes to Black
Hi there. I've been facing an issue for the past couple hours that I cannot figure out. When I run my game all of my Text objects that are not a special font, such as the defualt Ariel or Comic sans, change to black and will not change back when I try setting the color in the editor. The text will remain black until I save the scene, at which point they snap back to their proper color.
Something interesting that I noticed however is that If is slowly scale up the font size the text will change to light blue. Even though this is not the intended color. I tried making a simple helper script to attach to auto set colors and font sizes, that did nothing.
I have no idea whats happening or which direction to approach this from. Please Help.
No, not yet. But I have found that this doesn't occur in builds, only when running the game in the editor.
They are added to the Canvas as UI Text objects.
It's so weird that this issue still persists to this day
Hello there. This problem occurs when an error happens in the game. Any single error at start or awake can cause this problem. Do you get any errors when you play the game?
Answer by Kiragan · Aug 27, 2019 at 10:24 PM
Disable camera ( just untick it )
Enable camera
CTRL+S / COMMAND+S
Color will be back to yours. But only until your next action with UI in editor. Usualy this solution helps before you want test play.
Answer by ToruTheRedFox · May 17, 2020 at 01:22 PM
I find that reimporting the fonts fixes the issue for me
Answer by amir_sigma · Jan 13, 2020 at 10:38 AM
Just generate the lights again
Has nothing to do with lighting, as this happened in fully 2D games too.
Answer by LilGames · Apr 27, 2017 at 01:19 PM
Assign a Material to the Text component. You'll see your color come back. (It still does this in 5.5... don't know why. It will be fine without a material, and then poof! The text turns black and the only fix is assigning a material).
I just created a $$anonymous$$aterials Folder after i read your post and poof! The color on the text came back. I didn't do anything else. :)
It is not a bug, you have to exclude UI from Culling $$anonymous$$ask at Directional Light attached to your scene.. That helped me and hope it will help you..
Answer by roointan · Jan 20, 2020 at 02:02 PM
Getting help from Kizmiaz's comment, I tried unticking Occlusion Culling on the main camera, and it's resolved.
Just enable it, and the problem will not be back :)
Your answer
Follow this Question
Related Questions
Replacing transparency of text with a solid color? 1 Answer
Text Appearance Glitch in Unity UI, 5.3 0 Answers
How to measure the width of a string? 0 Answers
Trying to make Fonts Fallbacks to real Bold/Italic font data 3 Answers
Pixel Font is Blurry 4 Answers