Skip to content

Commit

Permalink
fix(Examples): prevent crash on scene change with active arrow
Browse files Browse the repository at this point in the history
When the arrow prefab had collided with something it would re-enable
the interactable object on the arrow causing a chain of events that
could cause a crash if the scene was being changed at the point
this was initiated.

This fix checks to make sure the arrow is still active before trying
to reset it.
  • Loading branch information
thestonefox committed Aug 14, 2017
1 parent 3bb973c commit 9ef2795
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void FixedUpdate()

private void OnCollisionEnter(Collision collision)
{
if (inFlight)
if (inFlight && isActiveAndEnabled && gameObject.activeInHierarchy)
{
ResetArrow();
}
Expand Down

0 comments on commit 9ef2795

Please sign in to comment.