- Home /
How to have fonts affected by lightning?
Hi guys. I'm trying to find a way to have the font I'm using in the game to be affected by lightning, that is, I want the font to be visible only when there's light shining on it. Here's an example of how it currently looks in the game:
I wanted the text to be hidden in this cenario, since there's no light around it. I'm guessing the problem is with the font material that I'm using not being designed for this, but I'm not sure. The component I'm using for the text is a Text Mesh:
Is there anyway I can solve this without having to use another font? Thanks!
The text mesh component is pretty much deprecated now. Ins$$anonymous$$d you should use Text $$anonymous$$esh Pro (included with Unity by default in the package manager for newer versions, or as a free download from the asset store for older ones). That is a better method for drawing text - and it also has support for lighting.
Answer by eplante · Aug 06, 2019 at 08:03 PM
I'd recommend you use TextMeshPro. It should be included in the newer versions of Unity, if you're using an older one, get it from the Asset Store. It makes text manipulations like this so much easier.
For your particular issue, you probably will have to work with shaders a bit. Luckily, TMPro makes that pretty easy (as easy as shaders can be, which is not necessarily easy by any means).
Answer by Edudjr · Jan 01, 2021 at 05:02 PM
If anyone is still wondering, there is a shader included in TMP which is capable of receiving lights: TextMeshPro/Mobile/Distance Field (Surface)
Your answer
![](https://koobas.hobune.stream/wayback/20220612210117im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Invisible Mesh with Animation And Shadow Sync...???,Invisible Mesh Animation with Shadows? 2 Answers
Shadow sprite rotation regardless of the light source 0 Answers
Example for Text -> Material usage 0 Answers
Part of text with different material 1 Answer
UI Text - changing material instance 1 Answer