public void SetNewTargetPos(Vector3 targetPos) { if (prevPos == null && !firstCall) { foreach (FlockAgent agent in agents) { Walk walk = agent.GetComponent <Walk>(); walk.MoveToTargetPos(targetPos, false); } this.prevPos = targetPos; } firstCall = false; this.prevPos = targetPos; }