Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

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

Discussion in 'UGUI & TextMesh Pro' started by roseportalgames, Aug 19, 2022.

  1. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    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?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    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.
     
  3. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Hmm, I did all of that and have the same issue. Can I provide you with any additional information?
     

    Attached Files:

  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    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?
     
  5. Vighnesh97

    Vighnesh97

    Joined:
    Aug 23, 2022
    Posts:
    1
    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. Screenshot (141).png
     
    juratedesigns likes this.
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    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.

    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.
     
    immerxive001 and JamesL98 like this.
  7. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    This worked cheers
     
  8. CD_JinSung

    CD_JinSung

    Joined:
    Mar 7, 2023
    Posts:
    2
    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
     

    Attached Files:

    Last edited: Jul 13, 2023
  9. Shoshinkai95

    Shoshinkai95

    Joined:
    Nov 7, 2021
    Posts:
    3
    how did you switch target platform to mobile?
     
  10. CD_JinSung

    CD_JinSung

    Joined:
    Mar 7, 2023
    Posts:
    2
    switch platform in file-build setting
     
  11. HunterAhlquist

    HunterAhlquist

    Joined:
    Oct 6, 2013
    Posts:
    135
    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.