- Home /
How to only use namespace if it exists?
Hi there,
I'm trying to make an asset. This is a script I want to make compatible for both TextMeshPro users, and people who don't use TextMeshPro.
To use TextMeshPro variables (for example: private TextMeshPro textMeshPro), you need to include:
using TMPro;
This however throws an error when the TextMeshPro asset is not being used.
So the thing is that I only need to use this namespace if the TextMeshPro asset is installed.
I can't use custom defines, because then I won't be able to share this when it's finished.
Is there anyway I can prevent this error?
2D Toolkit uses an editor checkbox to set its custom define when the user wants to use it with Spine.
it's highly professional, so if they do it that way it's probably a good one too.
Text$$anonymous$$eshPro developer Digital Native Studios was aquired by Unity. As a result the asset is now free to use download. So you could be able to ask the user to download the asset for usage in yours. Or based on the license, it may be included in your asset.
Your answer
Follow this Question
Related Questions
Text Mesh Pro : Unable to use pull down menu inspite of Distance field 16 0 Answers
Textmesh Pro Input Field Rich Text 3 Answers
How to change the text of textmesh pro text 2 Answers
Hide or Show Text objects from ui.button 1 Answer
Updating ui not working in fixed update .But it works in update 1 Answer