Enabling and Disabling Canvas causes TMP to GenerateTextMesh()

Hi,

Instead of setting the parent GameObject to on/off we enable/disable the canvas attached as it’s more efficient.
The problem we are encountering is that when enabling/disabling the canvas OnCanvasHierarchyChanged() is called which in turn marks the TMP component for graphic rebuild.

We have lots of TMP components on the canvas, but they don’t need their text regenerating as they aren’t changing, however the automatic dirtying is causes them to be regenerated.

Is there any way to avoid the rebuild happening?

Thanks,
Will

1 Like

As an experiment I just added in a return to the OnCanvasHierarchyChanged() so that when the canvas is enabled/disabled the text isn’t dirtying, which reduced the time massively. However, this is just a hacky way to prove that the text didn’t need regenerating, and comes with other problems.

Did you ever resolve this?

Seems to be still an issue in Unity 2021.3.10f1.