Weird bone rotation

Hey, so I’ve been having a problem with my bones for some time now, I tend to always use a custom shape for my bones so I never pay much attention to how things looks like with normal bones but now when trying to make models for Unity, this has been giving me a pain to actually figure out how to fix.

The best way to describe this would be with this gif I’ve made:

looking at the bones you can see that they are not joined together or not in a straight line as they should be, which I have no idea how to fix. When attempting to do this manually, the model in Unity then deforms (If I turn a hip bone 180 degrees, it’d look something like this:

How would I go about fixing this issue and connect the bones together, or at-least straighten them out, I can’t find anything on the internet with this issue as I don’t know how what it’d be called.

Hi, not sure what the issue is, those bones look straight to me ?

In the first image (blender) you can see the bones facing weird directions, one of those being above the hip (Spine) where instead of touching and connecting to the Chest bone, it goes to the left. On the ankle I’d also like it to be connected to the toes than going to the right. I’m not sure if this explained what’s wrong.