DragonWind

关于TextMeshPro的mark的tag标签的问题

太长不看请翻到最后有解决办法

First of all,是个坑

一些讨论

这里还有一些

这里也有一些

设计师的原话是

Just to provide more insight on this…

The underline, strikethrough and mark (highlight) geometry is contained in the primary mesh and added after the characters. As such these always render on top / after the characters which is fine for underline and strikethrough but not so good for the mark tag. This is simple the result of the order in which the geometry is created.

When using the tag with forces the creation of a sub mesh object which is render after the parent then the mark tag ends up behind the text which is the desired result.

Having said that, I plan on revising the geometry creation process to make sure the underline and mark are always rendered first / behind the characters and the strikethrough always on top.

I don’t have an ETA on this but that is the plan.

—-by Stephan_B

但是根据我的一些测试,总结出的一个结论就是

用mark标签的文本的高亮在底部还是在顶部是不确定

我们先new一个新项目,2022.3.4f1

Text中输入

前面<mark=#ed9b45>高亮文本</mark>后面

正常情况下是这样的

image-20231124113103455

这时候的图集是这样的

image-20231124113243302

但是如果我调整图集大小,让他有多个图集的话

image-20231124113358589

它就会变成

image-20231124113435466

哈哈哈哈哈,想不到吧,变成了这般摸样

经过多次测试我发现,只要生成了2个及以上的图集,那么:

FUCK BUG

太长不看

有两个解决办法

关于Sprite

先新建一个TMP_SpriteAsset,绑定好材质Material和图集Texture

再生成图集,这个图集只能是一张图,所以不能用uGUI的,用TexturePacker打包好。

通过Sprite名字和Name就能找到了。

TMP有一个回调TMP_Text.OnSpriteAssetRequest注册,在这里加载图集。