I know the correct way to create path is
ABPath p = ABPath.Construct(startPos, endPos, verificationCallback);
Does it compute the path, or is it only setting things up?
Because we would then feed it into the
AstarPath.StartPath(p)
which seems to compute the path.
What is the difference?
If I want it to avoid certain tags, should I modify the mask inside path before I pass it to AstarPath.StartPath()
?
Thank you!
Path.Construct is essentially the same thing as a constructor (i.e new MyType(…) ), however they are static methods instead in order to be able to use pooling to reduce the load on the GC.
StartPath will actually schedule the path to be calculated.
Note that path requests are still asynchronous, so it may take one or two frames to be calculated.
You can force it to be calculated immediately by calling p.BlockUntilCalculated()
.
Yes, you should modify the mask before you call StartPath.
p.enabledTags = ...;
1 Like