- Home /
GuiText changing color based on what is behind it (if black it is white and etc) make it easy to read.
I am working on android and am curious on how to set up a textMesh or a GuiText object to have the font dynamically change color so it is easier to read based on the background color. I have a status bar that i want to move in back of the text and want the text easy to read while the progress bar moves. I posted a similar problem but wanted to explain a bit more. Here is similarly what i want:
I was told to try a TextMesh object, and then use a custom shader that just inverts the color, but when i do, the shader appears just as a purple box when i push to my android device. I also cannot get the textMesh centered over a guiTexture i have on screen. If i use screenToWorld point and give it my main camera, it appears in the center of the screen and does not follow on screen when i rotate my camera. How would i take into account these variables?
Yeah I remember your least question. Just a thought for a different approach to make it legible - you could use a font that has an outline in Gold and black text - then it would be visible in both circumstances.
I want to avoid "hardcoding" this into my assets in case i add features or use some other color later. Right now i use a light blue and gold for my status bars but i am think of red and green for other builds as well. Any other ideas? I'm kinda stumped and the screenToWorld is annoying me half to death on how i get around the issue im having....
There would be a way of making it fit other colours if you used a white outline and then adjusted its colour in the shader color setting, but I understand you wish to do something different. Am thinking - but then again I'm not much of a shader programmer :S
I could use a shader, but i am unsure of how to do that and if it'll work on android honeycomb on the galaxy tab 10.1
maybe if i could get the text's inner body to not be transparent and be black itd be alright (i can have a white outline and a black interior)