NetworkPingDisplay: make connection quality readable (Q: STATUS [■■··]) and auto-size bar by enum
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
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:
After:
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.
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:
do you like this kind of visual?
@miwarnec Hey, I’d appreciate it if you could take a look at my PR and approve it if everything looks good.
looks good, but seems to break on Unity 6 as per CI. could you try it there once please?
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.