Follower entity setting the x rotation at 90 sometimes

The Follower entity script occasionally sets the X rotation to 90 degrees, causing the 2D sprite to disappear due to the angle. This issue doesn’t always occur; the script usually corrects itself with a target. However, sometimes when the agent does not have a target, it appears with an X rotation of 90 degrees (making the 2d object to be invisible). Is there a way to disable rotation entirely?

I personally added a separate DisableFollowerEntityRotation script on the same GameObject that the FollowerEntity script is on, and it sets updateRotation to false (see docs).

using UnityEngine;
using Pathfinding;

public class DisableFollowerEntityRotation : MonoBehaviour {
  [SerializeField] private FollowerEntity _ai;
  
  private void OnEnable() {
    _ai.updateRotation = false;  
    gameObject.transform.rotation = Quaternion.Euler(0, 0, 0);
  }

  private void OnValidate() {
    gameObject.GetComponentSelfParentChildren<FollowerEntity>(ref _ai);
  }
}

Hi

I have made a fix which could potentially also impact this. I’ll include this fix in the next update. Let me know if that fixes it.

1 Like