Shader error in 'TextMeshPro/Mobile/Distance Field': Couldn't open include file 'TMPro_Properties.cg

I am using:

Unity 2021.3.8f1

I upgraded my project from an older version.

Now I get purple text and this error:

Shader error in ‘TextMeshPro/Mobile/Distance Field’: Couldn’t open include file ‘TMPro_Properties.cginc’. at line 93
Shader error in ‘Hidden/SSAO’: Couldn’t open include file ‘frag_ao.cginc’. at line 58
Shader error in ‘TextMeshPro/Distance Field’: Couldn’t open include file ‘TMPro_Properties.cginc’. at line 126

I have literally tried everything, like:

  • Delete /Asset/TextMeshPro, reopen, reimport essentials
  • Delete and reinstall the plugin
  • Delete Library folder etc.
  • Try different Unity version
  • Try a different build platform target

Always the same.

I’ve been able to fix it in the past a few years ago but now it doesn’t work.

Please help?

This error is usually the result of some importer issue where the .cginc file gets messed. As you have done previously, re-importing the TMP Essential Resources or just the shaders themselves will resolve this issue.

What version of the TMP package are you using?

Note that the location of the TMP shaders has changed over the years where the shaders used to be located in “TextMesh Pro/Resources/Shaders/…” and are now located in “TextMesh Pro/Shaders/…”.

Please make sure that all of your TMP shaders are located in this folder as well as the .cginc file.

It is possible that somehow, you have some shaders located in a different location where they would not be able to located this .cginc file.

Let me know if you do find that you have some TMP shaders perhaps contained in some other location in the project and if any of the above has helped you resolve your issue.

Hmm, I did all of that and have the same issue. Can I provide you with any additional information?

Do you still get the error on the mobile shader or still on both “TextMeshPro/Mobile/Distance Field” and “TextMeshPro/Distance Field”?

What happens if you manually re-import the “TMPro_Properties.cginc” file?

Can you search the project to see if there are perhaps other versions of those shaders in other folders? Maybe a duplicate somewhere?

What happens if you create a new project and import the TMP Essential Resources? Do you still get those errors?

I am having the same error , i have tried creating new project and stuffs. This error occurs while running a project from Coursera on Vr Museum. But, when build a blank project, APK gets created without any hassle. But when this new project is ran, all the above mentioned errors will occur.

Kindly provide any alternate solutions as this shader issues from text mesh pro is being a headache.

1 Like

The above error is either the result of a corrupted “TMPro_Properties.cginc” or the shader compiler being unable to locate this file perhaps because the shaders that are referencing this file have been moved.

Note that TMP Shaders used to be located in “Assets/TextMesh Pro/Resources/Shaders” but were moved several releases ago to “Assets/TextMesh Pro/Shaders” to avoid having every shader always included in builds.

Can you look through your project and report the location of the TMP shaders.

Here is a screenshot of these shader files which should be located in “Assets/TextMesh Pro/Shaders” along with this “TMPro_Properties.cginc” as seen below.

8391360--1107288--upload_2022-8-25_22-32-22.png

Maybe this behavior is the result of having these shaders split between these different locations but the “TMPro_Properties.cginc” only being present in one of them. If that is the case, please move all shaders in the above location as per the screen shot.

2 Likes

This worked cheers

not work on me:(

unity 2021.3.5f1
TextMeshPro 3.0.6

/===================================/
now i solved problem

  1. switch target platform to mobile
  2. reimport textmeshpro essential
  3. switch target platform to PC

how did you switch target platform to mobile?

switch platform in file-build setting

This isn’t working for me, I’m thinking the latest preview package is broken in 2021. Reverted to the previous version and no shader errors or other issues.