I have a fairly simple rotate script in an object’s OnStateUpdate:
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Vector3 direction = player.transform.position - wheelBot.transform.position;
direction.y = 0;
wheelBot.transform.rotation = Quaternion.Slerp(wheelBot.transform.rotation, Quaternion.LookRotation(direction), 0.1f);
}
When I run it in the Editor, it runs fine. The object rotates towards the player as intended. But when I Build it out and run it, the object simply won’t rotate.
Some things to note:
- I’m Building it out to Windows x86
- The animations I’m using on the object are using Root Motion
- No errors are appearing in the Log when I run in the Editor
I would appreciate any idea as to why the rotation won’t work in the Build version. Thanks.