Character rotates towards move direction problem

I think this may be a bug, but I found a fix. I had to go into my character BP, get character owner, connect to character movement, and set orient rotation to movement (uncheck).
Not sure why this doesn’t work in the code and only works in BP.