Skip to content

Commit

Permalink
Test if OnBeforeRender gets called in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shaynie committed Jul 25, 2023
1 parent e5800b5 commit 80fd919
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ReticleVisibilitySettings VisibilitySettings
private void OnEnable()
{
rayInteractor.selectEntered.AddListener(LocateTargetHitPoint);
Application.onBeforeRender += UpdateReticle;
Application.onBeforeRender += OnBeforeRender;

// If no custom reticle root is specified, just use the interactor's transform.
if (reticleRoot == null)
Expand All @@ -61,13 +61,20 @@ private void OnEnable()
UpdateReticle();
}

[BeforeRenderOrder(XRInteractionUpdateOrder.k_BeforeRenderLineVisual)]
private void OnBeforeRender()
{
Debug.Log("OnBeforeRender()");
UpdateReticle();
}

/// <summary>
/// A Unity event function that is called when the script component has been disabled.
/// </summary>
private void OnDisable()
{
rayInteractor.selectEntered.RemoveListener(LocateTargetHitPoint);
Application.onBeforeRender -= UpdateReticle;
Application.onBeforeRender -= OnBeforeRender;

ReticleSetActive(false);
}
Expand Down

0 comments on commit 80fd919

Please sign in to comment.