Skip to content

Commit 3aa3141

Browse files
committed
moved avatar distance, fixed nameplates not show / hiding until other initiators run
1 parent b429981 commit 3aa3141

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

Basis/Packages/com.basis.framework/BasisUI/Menus/Main Menu Providers/SettingsProvider.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,16 @@ public static PanelTabPage GraphicsTab(PanelTabGroup tabGroup)
11851185
PanelSlider.SliderSettings.Distance(BasisLocalization.Get("settings.general.avatarRange"), 100),
11861186
BasisSettingsDefaults.AvatarRange);
11871187

1188+
PanelToggle toggleAvatarDistance = PanelToggle.CreateNewEntry(qualityGroup);
1189+
toggleAvatarDistance.Descriptor.SetTitle(BasisLocalization.Get("settings.developer.avatarDistance"));
1190+
toggleAvatarDistance.Descriptor.SetDescription(BasisLocalization.Get("settings.developer.avatarDistance.description"));
1191+
bool avatarDistOn = !string.Equals(BasisSettingsDefaults.VisualState.RawValue, "off", StringComparison.OrdinalIgnoreCase);
1192+
toggleAvatarDistance.SetValueWithoutNotify(avatarDistOn);
1193+
toggleAvatarDistance.OnValueChanged += (val) =>
1194+
{
1195+
BasisSettingsDefaults.VisualState.SetValue(val ? "only avatar distance" : "off");
1196+
};
1197+
11881198
PanelToggle toggleLimitAvatars = PanelToggle.CreateNewEntry(qualityGroup);
11891199
toggleLimitAvatars.AssignBinding(BasisSettingsDefaults.UseMaxVisibleAvatars);
11901200
toggleLimitAvatars.Descriptor.SetTitle(BasisLocalization.Get("settings.general.limitAvatars"));
@@ -1961,16 +1971,6 @@ void RefreshGizmoSubVisibility(bool masterOn)
19611971
debugGroup.SetTitle(BasisLocalization.Get("settings.developer.visualHelpers.title"));
19621972
debugGroup.SetDescription(BasisLocalization.Get("settings.developer.visualHelpers.description"));
19631973

1964-
PanelToggle toggleAvatarDistance = PanelToggle.CreateNewEntry(debugGroup.ContentParent);
1965-
toggleAvatarDistance.Descriptor.SetTitle(BasisLocalization.Get("settings.developer.avatarDistance"));
1966-
toggleAvatarDistance.Descriptor.SetDescription(BasisLocalization.Get("settings.developer.avatarDistance.description"));
1967-
bool avatarDistOn = !string.Equals(BasisSettingsDefaults.VisualState.RawValue, "off", StringComparison.OrdinalIgnoreCase);
1968-
toggleAvatarDistance.SetValueWithoutNotify(avatarDistOn);
1969-
toggleAvatarDistance.OnValueChanged += (val) =>
1970-
{
1971-
BasisSettingsDefaults.VisualState.SetValue(val ? "only avatar distance" : "off");
1972-
};
1973-
19741974
PanelToggle toggleStatistics = PanelToggle.CreateNewEntry(debugGroup.ContentParent);
19751975
toggleStatistics.Descriptor.SetTitle(BasisLocalization.Get("settings.developer.enableStatistics"));
19761976
toggleStatistics.Descriptor.SetDescription(BasisLocalization.Get("settings.developer.enableStatistics.description"));

Basis/Packages/com.basis.framework/UI/NamePlate/BasisRemoteNamePlateDriver.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ public static void ApplyNamePlateSettingsFromUI()
428428

429429
UpdateCachedColors(newTransparency);
430430

431+
FlushPendingStructuralChanges();
432+
431433
Vector3 scale = new Vector3(0.02f, 0.02f, 0.02f) * newSize;
432434
var arr = plates;
433435
int n = count;
@@ -888,6 +890,24 @@ public static void CompleteNamePlates()
888890
}
889891
}
890892

893+
/// <summary>
894+
/// Completes any in-flight pulse job and flushes queued plate add/removes into
895+
/// the live array. Safe to call off the per-frame path (e.g. on settings changes).
896+
/// </summary>
897+
private static void FlushPendingStructuralChanges()
898+
{
899+
if (jobScheduled)
900+
{
901+
handle.Complete();
902+
jobScheduled = false;
903+
}
904+
905+
if (pendingAdd.Count > 0 || pendingRemove.Count > 0)
906+
{
907+
ApplyPendingStructuralChanges();
908+
}
909+
}
910+
891911
private static void ApplyPendingStructuralChanges()
892912
{
893913
// Remove first (swap-back)

0 commit comments

Comments
 (0)