Skip to content

Commit

Permalink
fix(Cast): ensure pointer state is cleared on enable and disable
Browse files Browse the repository at this point in the history
The state of the pointer is now cleared on enable and disable to
ensure it is in the correct state.
  • Loading branch information
thestonefox committed May 6, 2023
1 parent eaabbdd commit c1bd830
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Runtime/Cast/PointsCast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,25 @@ public virtual void Process()

protected virtual void OnEnable()
{
points.Clear();
ClearState();
OnAfterTargetHitChange();
}

protected virtual void OnDisable()
{
ClearState();
ClearDestinationPointOverride();
}

/// <summary>
/// Clears the pointer state.
/// </summary>
protected virtual void ClearState()
{
TargetHit = null;
trackedOriginForward = null;
IsTargetHitValid = false;
points.Clear();
ClearDestinationPointOverride();
}

/// <summary>
Expand Down

0 comments on commit c1bd830

Please sign in to comment.