Sad post about UE5 source code
- Paul Swarrow
- Jul 25, 2023
- 1 min read
I've been trying to add some beauty to my plugin's code for a couple of days. The idea was to move MoveTo logic from the component responsible for character projection to virtualNavmesh to custom AI Controller. It should've been simple really: override MoveTo in AIController class so if there is DynamicSurfaceNavMesh under the character - the ghost AI controller will be called instead of original one. The only issue is to call proper callback on Character's AIController when the Ghost AIController finishes the moving.
Well. It didn't work. I probably was too naive to assume that AIController is incapsulated. First I've discovered that there is no way to override MoveRequestId in the PathFollowingComponent. Second - the behavior tree "move to" task uses access to PathFollowingComponent directly, so overriding AIController wont help anyway.
It looks like AIController was never meant to be extended cause it is hard to imagine how you can possibly replace some implementation inside it.
What does it mean? It mean plugin will be even more ugly, it terms of usage. The user will have to abandon native MoveTo task and use my custom.

On the other hand: maybe it is a way to implement Open-Closed principle. In some sense extending can be understood only like setting up. So override MoveTo complete - would be modifying, not extending. Which sounds more or less logical, but still sad.
To lighten the mood I downloaded some free assets. Sure as always they were a bit broken, but was worth it anyway:

Comments