I’m facing a rather annoying issue, with the FollowerEntity.
Basically, sometimes after the agent reaches its destination, it will just stand there because reachedEndOfPath never becomes true. I have stopping distance set at 2 and the agent is definitely within that range.
The weird thing is, this never happens if I have the gameobject with the FollowerEntity component selected in the hierarchy, and the component is expanded. The bug still happens if the gameobject is selected but the component is minimized in the inspector though.
I cannot make use of the debug info within the component inspector, because whenever the bug happens and I go select the agent to view the inspector, it instantly fixes itself and the agent reaches the destination correctly.
If this was only an editor bug I could deal with it, however the issue also persists in builds.
I’m happy to provide more information, but I do not know what information would be useful right now, so feel free to ask.
The issue is caused by setting facingDirection when calling SetDestination to anything else than default.
I noticed the issue only kept happening when the agent was reaching targets which I had set a specific facing direction on. For now I have removed the facing direction completely, and the issue has disappeared. I’m still looking for a proper fix however, because it has an impact for how believable the AI looks arriving to certain things with the wrong orientation.
Worth noting that I noticed that the issue fixes itself as well if movementOverrides.AddBeforeMovementCallback or movementOverrides.RemoveBeforeMovementCallback is called when the agent has reached the destination (similarly how expanding the inspector of FollowerEntity does).
Also having posted the code, I might as well ask, is there no way to add a PathEndingCondition directly to FollowerEntity, similarly as you can set the travesalProvider? I couldn’t find anything in the docs. As you can see right now I have to calculate the path manually and then set it with SetPath, which makes me unable to set the facing direction.
Yes indeed, I should have been a little more clear, but both validatePathBeforeMoving and customPathEndCondition are false for this scenario.
EDIT: I noticed that with those two parameters being false most of the code I posted is actually redundant, and the only notable thing here is setting the facing direction… oh well.
Also here are the settings for follower entity. Agent traversalProvider is also set to null in this scenario. I’m also using a script based on the MecanimBridge demo for root motion movement.