When I upgraded from version 5.3.8 to 5.4.4, the smart controller would start swaying in place.
I used a script. At the beginning of the script, it would give the agent a random target. The previous version was functioning properly but now it is malfunctioning.
After a simple test, if the target is moved close to the agent before the normal pathfinding movement occurs, it seems that there is an obstruction in the middle and an abnormality will occur when the distance is too far.
Can you provide more details/perhaps a video on this? I’m sorry, I’m having a hard time understanding the post.
Sorry, I didn’t explain clearly. Here is a gif.
There is a script that will provide a new coordinate once the destination is reached.
However, when the destination is far away and there are obstacles in between(The feeling after the test), the agent will stop at its current position.
If you drag the destination close to the agent, it will be able to find a proper path for movement.
After I directly provided the agent with a destination and clicked “play”, the same situation still occurred.
I remember that before using FollowEntity, it would continuously search for the shortest path to the target. But now, when I drag the destination to form a circular path, the path will also form a circle. Perhaps it is related to this issue
Hi
Are you using some kind of custom baking script for ECS?
There is only one script for setting a random destination.
If the random destination is far from the agent, the agent will stop moving.
I use the following script for random destination selection
#######################################
public class RandomDestinationSetter : MonoBehaviour
{
Transform destinationTarget;
FollowerEntity ai;
AIDestinationSetter destinationSetter;
void Awake()
{
destinationTarget = new GameObject("RandomDestinationTarget").transform;
ai = GetComponent<FollowerEntity>();
destinationSetter = GetComponent<AIDestinationSetter>();
destinationSetter.target = destinationTarget;
destinationSetter.target.position = AstarPath.active.graphs\[0\].RandomPointOnSurface(NNConstraint.Walkable,false).position;
}
void Update()
{
// Debug.Log("RandomDestinationSetter: OnUpdate called.");
//已经到达目的地,修改目的地
if(ai.reachedEndOfPath)
{
Debug.LogWarning("reachedEndOfPath");
ai.SetDestination(ai.position);
//Debug.Log("WalkAgentState: Reached end of path, setting new destination.");
destinationSetter.target.position = AstarPath.active.graphs\[0\].RandomPointOnSurface(NNConstraint.Walkable,false).position;
}
}
}
I tried your exact code on 5.4.4 and I’m sadly not seeing the same issue. Is your gif recorded in a new/clean project?

Edit: I did also try it with the RecastGraph not using tiles and had no issue there either. Let me know if there’s some part of my setup recreating this that I’m missing 
Thank you. I updated the version of the Entities package from 1.3.5 to 1.3.14, and this bug has disappeared.
Then I reverted back to entities1.3.5, and the problem occurred again. The version of Unity I used was 2022.3.34f1c1. The “c1” suffix seems to have appeared when downloading from China. If you need these details, they might be helpful.
###
The effect picture shown in the following gif seems to be a bug, but I really didn’t expect that. I always thought it was a specially designed logic because it seemed very natural and should be more complex than the shortest path.
If possible, the following path-finding method could become a new type of move agent.

This happens when the agent is not recalculating its path, and instead it only gets locally repaired every frame.