Skip to content

Commit

Permalink
fix(WalkAction): avoid missing target transform
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Aug 23, 2022
1 parent bb8cc80 commit ab26c73
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Assets/JCSUnity/Scripts/Actions/3D/AI/JCS_3DWalkAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ public bool IsArrived()
/// </returns>
public bool InRangeDistance()
{
if (mTargetTransform == null)
return false;

Vector3 targetPos = mTargetTransform.position;
Vector3 selfPos = this.transform.position;
float distance = Vector3.Distance(targetPos, selfPos);
Expand Down

0 comments on commit ab26c73

Please sign in to comment.