So, I’ve downloaded the TextMeshPro(v1.4.1) package, and I moved the source into my ‘Assets/’ folder.
And I noticed that I can’t access to any of my code under ‘Scripts’ folder.
TextMeshPro uses asmdef file to seperate itself into different dll.
So I wonder, is it still possible to access my scripts in any other packages? I know that sounds strange, but I need to modify the codes in TextMeshPro, and I’ve tried to delete those asmdef files, it didn’t work : encountered other errors: UnityEngine.TextCore.LowLevel.GlyphValueRecord became no more accessible for TMP…
So if no one knows how to resolve this issue, I’m just gonna have to inherit TextMeshPro instead of modify it directly…
Hi, that’s exactly what I did. I mean, I can do any change to the source code, except trying to access to other classes defined in global namespace in my scripts folder.
I believe those scripts are under Assembly-CSharp, while TMP remain in a separate assembly because of asmdef.
Well, you answered the question yourself. Scripts outside Assets path (i.e. Packages/), are required to create an Assembly Definition Asset in a folder, to compile into a separate managed assembly. All package assemblies are compiled before the Assembly-CSharp, therefore it’s not possible for the TMP package to reference scripts in Assembly-CSharp.
Opt 1, refactor you code to pull another package, i.e. package-shared. Change the asmdef file of TMP package to reference the new package asmdef. This is a common practice to solve the reference issue.
Opt 2, move the TMP folder to Assets, delete the asmdef file so all codes are compiled into the Assembly-CSharp. But it may slower the compiler because of those TMP scripts.
Opt 1, currently not possible for the project…
Opt 2, tried, and I got some errors from TMP after I removed those asmdef files… TMP references internal class in UnityEngine.dll, and after I removed the asmdef file, it started to give me undefined symbols…
So, my final solution is: Inheritance… I inherited from TMP class, and put my custom code in the derived class…