Skip to content

Commit

Permalink
fix nre
Browse files Browse the repository at this point in the history
  • Loading branch information
NickKhalow committed Sep 17, 2024
1 parent 7f466c8 commit 203a646
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public partial class UpdateCurrentSceneSystem : BaseUnityLoopSystem

private readonly SceneAssetLock sceneAssetLock;

private IDebugContainerBuilder debugBuilder;
private ElementBinding<string> sceneNameBinding;
private ElementBinding<string> sceneParcelsBinding;
private ElementBinding<string> sceneHeightBinding;
private DebugWidgetVisibilityBinding debugInfoVisibilityBinding;
private readonly IDebugContainerBuilder debugBuilder;
private readonly ElementBinding<string> sceneNameBinding;
private readonly ElementBinding<string> sceneParcelsBinding;
private readonly ElementBinding<string> sceneHeightBinding;
private readonly DebugWidgetVisibilityBinding debugInfoVisibilityBinding;
private bool showDebugCube;
private GameObject sceneBoundsCube;

Expand All @@ -44,12 +44,17 @@ internal UpdateCurrentSceneSystem(World world, IRealmData realmData, IScenesCach
this.sceneAssetLock = sceneAssetLock;
ResetProcessedParcel();

debugInfoVisibilityBinding = new DebugWidgetVisibilityBinding(true);
sceneNameBinding = new ElementBinding<string>(string.Empty);
sceneParcelsBinding = new ElementBinding<string>(string.Empty);
sceneHeightBinding = new ElementBinding<string>(string.Empty);

debugBuilder.TryAddWidget(IDebugContainerBuilder.Categories.CURRENT_SCENE)?
.SetVisibilityBinding(debugInfoVisibilityBinding = new DebugWidgetVisibilityBinding(true))
.AddCustomMarker("Name:", sceneNameBinding = new ElementBinding<string>(string.Empty))
.AddCustomMarker("Parcels:", sceneParcelsBinding = new ElementBinding<string>(string.Empty))
.AddCustomMarker("Height (m):", sceneHeightBinding = new ElementBinding<string>(string .Empty))
.AddToggleField("Show scene bounds:", (state) => { showDebugCube = state.newValue; }, false);
.SetVisibilityBinding(debugInfoVisibilityBinding)
.AddCustomMarker("Name:", sceneNameBinding)
.AddCustomMarker("Parcels:", sceneParcelsBinding)
.AddCustomMarker("Height (m):", sceneHeightBinding)
.AddToggleField("Show scene bounds:", state => { showDebugCube = state.newValue; }, false);
this.debugBuilder = debugBuilder;
}

Expand All @@ -72,7 +77,7 @@ protected override void Update(float t)
UpdateCurrentScene(parcel);
UpdateCurrentSceneInfo(parcel);

if (debugBuilder.IsVisible && debugInfoVisibilityBinding.IsExpanded)
if (debugBuilder.IsVisible && debugInfoVisibilityBinding.IsConnectedAndExpanded)
RefreshSceneDebugInfo();
}

Expand Down

0 comments on commit 203a646

Please sign in to comment.