FollowerEntity bugfix for ignoring updateRotation = false

Your RVO 2D example with FollowerEntity shows setting updateRotation = false every frame (MechanimBridge2D.cs). When I tried setting updateRotation to false only once in Start() my agents still rotated.

Workaround script:

    public sealed class AstarRotationBugfix : MonoBehaviour
    {
        void Update()
        {
            var fe = GetComponent<FollowerEntity>();
            fe.updateRotation = false;
            if (!fe.updateRotation)
                enabled = false;
        }
    }

Request: it would be better if updateRotation behaved as expected, even if set in Start(). Or give the option to remove this SyncRotationWithTransform component entirely because it’s unneeded for most 2D use cases. I’d like that as an option in the Inspector.

Hi

Do you by any chance enable/disable the FollowerEntity component or GameObject when the game starts? This flag is reset whenever the component is disabled.

I have a unit test for setting updateRotation during Start, and it works fine.

Yes! I see. It’s off for a networking reason.

Looking into this more, it would be best if this were an option in the Inspector for my 2D use case.

The way it is now, it means I can’t turn off/on the FollowerEntity component later either because then the rotations start happening again.

Hi

I have added it to the inspector for the next update. So it will work as expected then :slight_smile:

1 Like

Thank you! You’re da best <3