JohnBaracuda / com.baracuda.runtime-monitoring

Runtime Monitoring is an easy way for you to monitor the value or state of custom C# members during runtime. Just add the 'Monitor' attribute to a field, property, event, method or even class and get its value or state displayed automatically in a customizable and extendable debug UI.
MIT License
408 stars 22 forks source link

Truncated text in tracked values. #28

Open piotrmuzolf opened 3 months ago

piotrmuzolf commented 3 months ago

Sometimes text is truncated due to not enough space for whole text to appear in some of the tracked values. It happens in unity 2023 and 6.0, didn't seem to happen before that. I believe reason for that is that something changed in Unity 2023+ with UnityEngine.GUIStyle.CalcSize() method and is no longer giving proper value. To fix that issue all you have to do is add 1 extra pixel in width of calculated size and issue is gone.

I fixed that locally for myself by adding field: private readonly Vector2 extraTextSize = new Vector2(1, 0);

And then applying it to 4 textDimensions fields inside MonitoringUIFallback e.g.: var textDimensions = ctx.Style.CalcSize(_content) + extraTextSize;

Issue: image

After fix: image