agens-no/PolyglotUnity

Missing reference to TextMeshPro package Unity 2018

Biodam opened this issue · 1 comments

Hello

First of all your asset seems to work pretty well.

I just found a bug with the TextMeshPro integration.

When I try to use Polyglot with TextMeshPro from the Unity Package Manager (upm) I got the following error e many different scripts:
Assets/Polyglot/Scripts/LocalizedTextMeshPro.cs(3,7): error CS0246: The type or namespace name `TMPro' could not be found. Are you missing an assembly reference?

My friend (@Lawendt) discovered this link that suggested the solution.

Open PolyglotScripts.asmdef and PolyglotEditor.asmdef in a text editor and manually add the dependency to Unity.TextMeshPro.

Your files should look like this:
PolyglotScripts.asmdef

{
    "name": "Polyglot.Scripts",
    "references": ["Unity.TextMeshPro"],
    "optionalUnityReferences": [],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false
}

PolyglotEditor.asmdef

{
    "name": "Polyglot.Editor",
    "references": [
        "Polyglot.Scripts",
        "Unity.TextMeshPro"
    ],
    "includePlatforms": [
        "Editor"
    ],
    "excludePlatforms": []
}

This makes the scripts find the dependency of TextMeshPro and everything seems to be working fine.

Someone in the forum said that the assembly definition file will provide a way to add dependencies to unity packages (from upm) through the editor, for now, the solution is to manually add it.

Unity 2018.1.3f1
TextMeshPro 1.2.3 (from upm)

This also happened to me when I integrated Polyglot in Unity 2018.1.7f1 with TextMeshPro from the Unity Package Manager. Thank you very much for your solution, @Biodam .

(I also noticed that now TextMeshPro didn't automatically had its "TMP_PRESENT" Scripting Define Symbol as it used to do before - I had to manually add it, so Polyglot would compile its support for TMP)