Which way is correct to generate a path with 4.3.83?

Just upgraded to 4.3.83, and got the warning:

A path was calculated, but no callback was specified when calling StartPath. If you wanted a movement script to use this path, use ai.SetPath instead of calling StartPath on the Seeker directly. The path will be forwarded to the attached movement script, but this behavior will be removed in the future.

And saw the patch-log mention it as well. But unsure how to solve it, as I could simply add a callback in the method, which is thrown away? Or should I instead calculate the path in another system and send it to the Ai.SetPath(Found_Path), in that case, which system will calculate the path? the AI? RVO Controller? a modifiers (if I use multiple modifier, which? e.g. Funnel-Modifier)

Best regard
Manavind

Notice they won’t even move with 4.3.83 using the Seeker.StartPath when just adding the callback parameter.

Hey there :slight_smile:

if I understand you right, you would like to have a callback whenever you do calculate a path?
Had the same problem, and I did override the RichAI class to get something like that:

  public class MovementAgent : RichAI
  {
      public event System.Action<Path> OnPathFound;

protected override void OnEnable()
{
	base.OnEnable();

	Reset();
}

public void Flee(Vector3 fleeFrom, float distance, float aimStrength = 1)
      {
          // The path will be returned when the path is over a specified length (or more accurately when the traversal cost is greater than a specified value).
          // A score of 1000 is approximately equal to the cost of moving one world unit.
          var theGScoreToStopAt = (int)(distance * 1000f);

          // Create a path object
          var path = FleePath.Construct(transform.position, fleeFrom, theGScoreToStopAt);
          // This is how strongly it will try to flee, if you set it to 0 it will behave like a RandomPath
          path.aimStrength = aimStrength;
          // Determines the variation in path length that is allowed
          path.spread = (int)Mathf.Max(4000, distance);

          // Start the path and return the result to MyCompleteFunction (which is a function you have to define, the name can of course be changed)
          seeker.StartPath(path, TrySendOnPathFound);
      }

protected override void OnPathComplete(Path p)
{
	base.OnPathComplete(p);

	TrySendOnPathFound(p);
}

private void TrySendOnPathFound(Path p)
{
	if (p.IsDone())
	{
		OnPathFound?.Invoke(p);
	}
}

Hope this helps :slight_smile: