Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MeshEffect doesn't work with Layout system #6

Open
markv12 opened this issue Apr 9, 2019 · 4 comments
Open

MeshEffect doesn't work with Layout system #6

markv12 opened this issue Apr 9, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@markv12
Copy link

markv12 commented Apr 9, 2019

I am using this library for the Outline 8 shadow effect on a TextMesh Pro Text object. The resulting shadow is sharper and looks better on pixel fonts than the default TextMesh Pro outline.

But I'm finding that it doesn't work well with the Unity layout system.
If TextMesh Pro text objects are part of a layout or have a ContentSizeFitter on them, At certain times, especially if you call:
LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
You get an error like this:

Mesh.vertices is too small. The supplied vertex array has less vertices than are referenced by the triangles array. UnityEngine.Mesh:set_vertices(Vector3[]) TMPro.TextMeshPro:GenerateTextMesh() (at Library/PackageCache/[email protected]/Scripts/Runtime/TMPro_Private.cs:3796) TMPro.TextMeshPro:CalculateLayoutInputVertical() (at Library/PackageCache/[email protected]/Scripts/Runtime/TextMeshPro.cs:534) UnityEngine.Canvas:SendWillRenderCanvases()

Any idea what might be causing this?

Thank you!

@mob-sakai mob-sakai self-assigned this Apr 9, 2019
@mob-sakai mob-sakai added the bug Something isn't working label Apr 9, 2019
@mob-sakai
Copy link
Owner

Hi @markv12
Thank you for reporting!

@markv12
Copy link
Author

markv12 commented Apr 11, 2019

I also seem to get similar errors when adding the Shadow effect for the first time.
The errors usually come in sets, one error for Verts, UVs, Tris, etc...
It seems like there is some event that isn't being listened for. Text mesh pro tries to update the verts and because the other lists have 9x more elements than they would usually, you get this error.

@mob-sakai
Copy link
Owner

Yes.
To be honest, in some cases, UIShadow doesn't work well with TMPro. :(

I fixed some of this plugin.
If it works for you, I will release it ASAP. :)
fixed.unitypackage.zip

@markv12
Copy link
Author

markv12 commented Apr 16, 2019

The relevant changes are in BaseMeshEffect.cs only correct?
Or are there other changes that are important to the fix?
I'm still getting the error when using a ContentSizeFitter.

If a TextMesh Pro object on a canvas has a ContentSizeFitter and I do anything like add another UI object to the canvas, I get this error and several others for UVs, Colors, etc...

Mesh.vertices is too small. The supplied vertex array has less vertices than are referenced by the triangles array. UnityEngine.Mesh:set_vertices(Vector3[]) TMPro.TextMeshPro:GenerateTextMesh() (at Library/PackageCache/[email protected]/Scripts/Runtime/TMPro_Private.cs:3796) TMPro.TextMeshPro:CalculateLayoutInputVertical() (at Library/PackageCache/[email protected]/Scripts/Runtime/TextMeshPro.cs:534) UnityEngine.Canvas:SendWillRenderCanvases()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants