Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[Solved] Crash when using Quads with UI Super Text Mesh

A topic by ClementCasaRara created Feb 22, 2017 Views: 1,972 Replies: 33
Viewing posts 1 to 25 of 26 · Next page · Last page
(2 edits)

Hi,
I'm testing out the various features of Super Text Mesh and I consistently get a crash when I try to use the inline quads in a UI setting.

The repro step is the following:


  1. Create a new project with Unity 5.5.0f3.
  2. Import Super Text Mesh.
  3. Add a Super Text Mesh component in the scene by doing 'right click>UI>Super Text Mesh'.
  4. Change the text to '<q=anybutton>'.
  5. Unity crashes with this Editor.log.

If instead of '<q=anybutton>' I type '<q=cross>', it works but my console is spammed with this error (and will crash whenever I add another inline tag):

Converting invalid MinMaxAABB

UnityEngine.Mesh:SetTriangles(List`1, Int32)

SuperTextMesh:SetMesh(Single, Boolean) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:2377)

SuperTextMesh:SetMesh(Single) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:2345)

SuperTextMesh:Rebuild(Single) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:925)

SuperTextMesh:Rebuild() (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:884)

SuperTextMesh:Update() (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:931)

Developer

Oof, yeah this looks like the whole "multiple materials on a canvas crash Unity" bug again. I tried to fix this in the latest update since it seemed to be fixed on my computer, but I suppose it's not the case? I've been asking on the Unity forums for months how to solve this and never got a reply, so it's hard to tell if this is something wrong w/ Unity, or if I'm setting materials incorrectly.

One user has already contacted me about this, but all I can really do right now is add a toggle to enable/disable multiple materials on UI? I'll be uploading that version soon, but that's not really the best fix. I'm developing on a mac, and don't have access to a PC to test this yet, and I'm not too sure where to begin...

I'm coding blind, but give this a shot:

Around line 2430 or so, you'll see a block of text like this:

c.materialCount = newMats.Length+1;

for(int j=0; j<c.materialCount-1; j++){

c.SetMaterial(newMats[j],j);

}

Try changing it to be like this:

c.materialCount = newMats.Length+2;

for(int j=0; j<newMats.Length; j++){

c.SetMaterial(newMats[j],j);

}

In the previous build, adding that +1 prevented the crash for me, so it's just a guess, but maybe this'll work?

I'm afraid it didn't work. :(

Do you need more info?

Developer (1 edit)

Damn, I'm really not sure, then! That log is very handy though, but it's all Unity backend stuff that I don't know how to make sense of. I'll try getting in contact w/ Unity again, but I've had no luck so far.

Til then, the non-UI canvas should work perfectly.

I entered a crash report to Unity as well. I'll let you know once the issue is created.

Developer

Sweet! Just pushed an update that makes this a toggle for now, and tried emailing someone at Unity who helped me before. I really want to get this bug taken care of once and for all

Same problem here. You have all my votes on the issue tracker when the issue is listed. I've tried to fix it myself in the previous version but Unity seems to crash no matter what and there is nearly no information available about setting CanvasRenderer materials on google.

Update:

Hey,

We have been able to reproduce this bug and have sent it for resolution with our developers.

We highly appreciate your contribution. If you have further questions, feel free to contact us.

Regards,

Lukas A.

Unity QA Team


Talking about the issue tracker, I have a fogbuz ticket because I reported it through the crash reporter. Should this create an issue tracker? Or are there 2 independent reporting systems?

Developer

I'm honestly not sure? Unity has so many different things that do the same thing so it's kinda hard to keep track of. But let me know if you get any updates, or they need more info from me. I also made this forum post about the issue, but it kinda accidentally turned into a journal: https://forum.unity3d.com/threads/canvasrenderer-crashes-unity-when-given-a-mesh-that-has-submeshes-more-than-one-material.439133/

From a comment(by one of the unity guys) I found on the unity forum

"When you submit a bug to us through the bug reporter, it goes to our internal bug tracking system FogBugz. After it's checked by someone in QA that it's not private or under NDA, the status is made public, and the Issue Tracker will pick it up and display it publicly on the Issue Tracker site (minus your machine information, logs & example projects, those are kept private). So there is no submitting bugs to the Issue Tracker, it just crawls through bugs that are public and displays them. "

So I guess you don't need to open an issue in issue tracker.

Thanks for the precisions noanoa.

I poked them to know if we can get an ETA on the fix.

Here's the issues tracker bug:

https://issuetracker.unity3d.com/issues/unity-cras...

Let's vote it up to the skies!

Hey guys! I was wondering if anyone had any luck with this. I snagged Super Text Mesh a week or two ago and it's been super fantastic so far, but adding inline images/quads to UI text causes Unity to stop responding when I go into play mode, and I have to force quit each time. Anyone happen to have clues to workarounds or solutions?

Thanks!

Developer (1 edit)

Hey!

If you're using the most recent version, v1.4.5, you're going to have to keep the "multi material UI" bool under the "Appearance" tab unchecked. It doesn't cause a crash on Mac, but causes a nasty crash on Windows, unfortunately. The bool was left in for when Unity eventually fixes the bug, or gets back to me on what else to do to prevent the crash.

For now, I highly recommend not using Unity UI, and just using the standard text mesh, which is fully-featured.

I have an "Anchor to Screen" script that replaces the screen-anchoring feature of Unity UI that I've been meaning to release, so I can give you an early version of the code if you want to try it out!

I also recently picked up a Windows PC, so I'll be trying again to solve this bug in the near future!


(Oh oops, didn't realize this was a reply to the thread at first, didn't mean to explain that all again)

Thanks so much for the speedy reply! I'll go ahead and try rebuilding my UI without using Unity UI, but apologies in advance if I bug you for help in the near future.


And yes! I'd be thrilled to take a look at that anchor code if it isn't too much trouble. Feel free to shoot me a note at grey2scale@gmail.com whenever's convenience.


(And again, the asset's super fantastic otherwise! It's helping me bring some very specific text ideas I had to life, so thanks again for your work on this.)

Developer

Just a note, this bug doesn't happen on Windows in Unity 5.3.4, which I build STM in, but happens in Unity 5.6. I'm not sure what changed between those two versions, but it's a step forward, I guess?

Apparently the issue was closed as "not reproducible"... (https://issuetracker.unity3d.com/issues/unity-cras...)
Yet I just reproduced it in 5.6.0f3.

No workaround on your side KaiClavier?

Developer (1 edit)

Still no fixes here, even when trying to fix it from a Windows machine. I even managed to get a crash log I've never seen before, and it didn't lead to any new clues. (The log just said the material array had too many things in it, but changing that still crashes) Since I can't seem to figure out why Unity UI is causing issues, I've made an asset that completely replaces Unity UI and should be up on the Unity Asset Store shortly. If anyone in this thread wants a free copy for putting up w/ all this, let me know! I'll hopefully put it on itch shortly so I can distribute some keys.

Not exactly the best fix for the issue, but it is a workaround, and I don't see myself needing Unity UI for anything w/ this new asset.

I'd be very interested in that new UI replacement asset!

Developer

Email me through my website, please! I don't have the itch page ready yet, so I can send you a .unitypackage for now

Update from Unity:

"Hey,

We've tested this on Unity 2017.1.0 and the crash does not occur there.
2017.1.0 is currently in beta but it should roll out soon.

If you are able to reproduce it with unity 2017.1.0, please respond to this email."

So I can confirm that it no longer crashes Unity on 2017.1.0b5 but instead it doesn't show anything whenever using a tag that relies on a texture (<q>, <c>, etc.)

Developer

I have a feeling this might have to do with the "Multi Material UI" bool? Make sure it's checked/unchecked to test this.

(1 edit)

Yep, I checked and icons appeared! \o/
Although not super well:
http://imgur.com/a/KxN2p
http://imgur.com/a/lFtCV

Developer

Oh boy, that's a new one... Is anything similar happening with the non-UI mesh? If not, then it's gotta be either Unity UI itself, or the code that sets the materials.

The non UI one works as before.

Got it!
On the canvas containing the SuperTextMesh, make sure that Additional Shader Channels has at least TexCoord1.
I guess that solves it all! \o/

Thanks for the support.

Developer (4 edits)

Testing this out more in-depth now!

The additional shader channels variable seems to have been added in Unity 5.6, so this should fix it for that. But even though I'm following the sample code on the page here: https://docs.unity3d.com/ScriptReference/Canvas-additionalShaderChannels.html it still seems to cause a crash after a second or so. Are you applying the code in a different place? I'm applying it to the parent canvas immediately before the materials are set.

Setting the canvas to have the extra layers in the inspector also seems to crash. Not sure what I'm doing differently?

I don't think I follow you.
I'm setting the shader channel variable through the inspector field on the Canvas, not through code.
Also, I only tested on 2017.1.0b5, since that version didn't crash like 5.6, I assume they changed something.

Developer

Ahh okay. Hopefully it'll be fixed in the next major Unity release, then?

Yep. 2017.1 should be released around June. But I think you might have to display a message if the user adds a SuperTextMesh to a canvas that doesn't have the correct shader channel.

Developer

I think I'll be able to add the shader channel myself through code when that comes, so hopefully this works! Either way, my asset that replaces Unity UI should be going up soon, too. Let me know if you want a copy!

Viewing posts 1 to 25 of 26 · Next page · Last page