UnityMarkdownViewer
UnityMarkdownViewer copied to clipboard
Markdown Viewer doesn't render any spaces in Unity 2023.1 or later
Thetextalllookslikethis.
It looks like this is due to GUIStyle.CalcSize()
not counting the trailing space. LayoutBuilder.AddWord()
calls CalcSize()
on a string with a trailing space for each word. But I'm not sure why this used to work. Did the CalcSize() implementation change?
It looks like the implementation of CalcSize() has changed in Unity.
I have attached a quick work around as a pull request to this issue. However, it is not clear to me whether this is an intentional change in behaviour or a bug, given 2023.2+ are all in beta.
So I am reluctant to merge this in (or actually write a better fix and not hardcode the values) right now. What do you reckon?
Ah OK, looks like it was a bug with Unity. Maybe I should have checked there first :)
https://issuetracker.unity3d.com/issues/text-in-the-inspector-window-appears-with-missing-spaces-when-using-guistyle-dot-calcsize-and-inspecting-a-file-in-the-inspector-window
This has been fixed in 2023.3.
Actually, I'm going to keep this issue open for now to keep track of it until Unity actually release the fix.