Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

NetworkPingDisplay: make connection quality readable (Q: STATUS [■■··]) and auto-size bar by enum

Open tigran-sargsyan-w opened this issue 3 months ago • 5 comments

This PR improves the default NetworkPingDisplay overlay so that connection quality is immediately readable and consistent across enum changes.

Replaces the hard-to-parse “dash count” with:

  • Q: EXCELLENT [■■■■] / Q: ESTIMATING [····]
  • Auto-sizes the bar based on the ConnectionQuality enum (no magic numbers).
  • Keeps the change minimal: only tweaks inside OnGUI(), no public API changes.

Motivation The previous UI showed quality as a growing number of dashes:Q: ---- This is ambiguous for players and non-obvious for developers (how many “-” is GOOD?). Explicit text + a fixed-length bar is a common visual language and improves usability without adding complexity. Especially when we work in Editor Screenshot 2025-09-15 203006

What changed (high level)

  • Compute totalSegments from the enum: int totalSegments = Enum.GetValues(typeof(ConnectionQuality)).Length - 1;
  • Build a compact bar using filled/empty glyphs (■ / ·)(made also customizable) based on (int)quality.
  • Print Q: {STATUS} [{bar}] and keep RTT as before.

Before / After

Before: Screenshot 2025-09-15 201324 Screenshot 2025-09-15 202500

After: Screenshot 2025-09-15 200718 Screenshot 2025-09-15 202311

tigran-sargsyan-w avatar Sep 15 '25 18:09 tigran-sargsyan-w

If we do this, the EXCELLENT should be shortened to GREAT so it doesn't rattle the UI so much. Alternatively, we could show the "unlit" bars so it would be obvious that there's always max 4 bars and only some are lit with color.

MrGadget1024 avatar Sep 15 '25 18:09 MrGadget1024

If we do this, the EXCELLENT should be shortened to GREAT so it doesn't rattle the UI so much. Alternatively, we could show the "unlit" bars so it would be obvious that there's always max 4 bars and only some are lit with color.

Well, in fact, I don't think it's worth replacing EXCELLENT with GREAT, but in principle it's also possible. Just so as not to change the code and so that there are fewer changes and dependencies. It's better to change only this script. Since many people probably use ConnectionQuality.EXCELLENT in their projects directly, and if you change the original version, it might cause more problems for the guys who use Mirror.

then what do you think about this option: Screenshot 2025-09-16 121638 Screenshot 2025-09-16 121700 Screenshot 2025-09-16 121715 Screenshot 2025-09-16 121725

do you like this kind of visual?

tigran-sargsyan-w avatar Sep 16 '25 10:09 tigran-sargsyan-w

@miwarnec Hey, I’d appreciate it if you could take a look at my PR and approve it if everything looks good.

tigran-sargsyan-w avatar Sep 18 '25 12:09 tigran-sargsyan-w

looks good, but seems to break on Unity 6 as per CI. could you try it there once please?

miwarnec avatar Sep 28 '25 16:09 miwarnec

looks good, but seems to break on Unity 6 as per CI. could you try it there once please?

Hi @miwarnec , I retested locally on Unity 6 — everything works as expected and matches the screenshots. The CI failure seems unrelated to the code: the Unity 6 job can’t access repo secrets (Resource not accessible by integration, Missing Unity License File/Serial), so it never actually runs the build/tests.

tigran-sargsyan-w avatar Sep 29 '25 13:09 tigran-sargsyan-w