MeshEffectForTextMeshPro provide visual effect components for TextMeshPro in Unity.
<< Description | WebGL Demo | Download | Usage | Example of using | Development Note | Change log >>
Do you like TextMeshPro? I’m lovin’ it:)
As you know, TextMeshPro, the ultimate text solution, is one of the greatest assets in Unity.
It is more beautiful than the standard TextMesh and Text, it is highly functional and free.
One of the big mystery of TextMeshPro is that "typical mesh effects (vertex effects) for uGUI can not be used for TextMeshPro".
Since TextMeshPro does not call IMeshModifier
interface, TextMeshPro ignores the typical mesh effects.
The mesh effects of TextMeshPro (eg VertexJitter, VertexColorCycler etc) are very unique in their implementation and can only be used for TextMeshPro...
I think that an easy way to implement a common mesh effect is necessary.
This project provides a base class for mesh effect.
It works well not only for standard Graphic components (Image, RawImage, Text, etc.) but also for TextMeshPro and TextMeshProUGUI.
Just change your mesh effect a few places, it will support TextMeshPro!
Let's decorate your TextMeshPro with effects!
//#define NOT_USE_TMPRO // If your project does not use TMPro, uncomment this line.
Import Package > Custom Package
from the Assets
menu.Add Component
in inspector or Component > MeshEffectForTextMeshPro > ...
menu. //#define NOT_USE_TMPRO // If your project does not use TMPro, uncomment this line.
BaseMeshEffect
to Coffee.UIExtensions.BaseMeshEffect
.
// Before
public class YourMeshEffect : BaseMeshEffect
or
public class YourMeshEffect : MonoBehavior, IMeshModifier
// After public class YourMeshEffect : Coffee.UIExtensions.BaseMeshEffect
2. If you are using specific methods, override it properly.
* OnEnable, OnDisable, LateUpdate, OnDidApplyAnimationProperties, OnValidate, ModifyMesh.
* Call `base.xxx` except ModifyMesh.
```cs
// Before
void OnEnable ()
{
...
}
void OnDisable ()
{
...
}
...
void ModifyMesh (VertexHelper vh)
{
...
}
// After
protected override void OnEnable ()
{
base.OnEnable();
...
}
void OnDisable ()
{
base.OnDisable();
...
}
...
public override void ModifyMesh (VertexHelper vh)
{
//base.ModifyMesh(vh); <- ModifyMesh's base method is unnecessary.
...
}
graphic.SetVerticesDirty
to SetVerticesDirty
// Before
public bool horizontal { get { return this.m_Horizontal; } set { this.m_Horizontal = value; graphic.SetVerticesDirty(); } }
// After public bool horizontal { get { return this.m_Horizontal; } set { this.m_Horizontal = value; SetVerticesDirty(); } }
4. If there are compile errors, remove them.
<br><br><br><br>
## License
* MIT
* © UTJ/UCL
## Author
[mob-sakai](https://github.com/mob-sakai)
## See Also
* GitHub page : https://github.com/mob-sakai/MeshEffectForTextMeshPro
* Releases : https://github.com/mob-sakai/MeshEffectForTextMeshPro/releases
* Issue tracker : https://github.com/mob-sakai/MeshEffectForTextMeshPro/issues
* Current project : https://github.com/mob-sakai/MeshEffectForTextMeshPro/projects/1
* Change log : https://github.com/mob-sakai/MeshEffectForTextMeshPro/blob/master/CHANGELOG.md