I've imported a character into Unity for a college project and for some bizarre reason, the legs of my character 'squash upwards' when his idle animation plays, either in-game or in the preview window. If I load my character up in Blender though, the animation is perfectly fine. Nothing deforms incorrectly. I'm not sure what the problem is or how I could fix it. I've also tried exporting it as an FBX file, but the animations flicker or the character completely disappears when they play.
Select bones. CTRL+A (apply transformation), play animation on Blender. It will deform. This is the same result you see in Unity. Delete your animation. Correct and regenerate (re animate) your bones. Now, if you export, unity will see them correctly.
You ALWAYS need to ZERO (freeze), CTRL A (apply transformations) To anything you do in rigging before start animation.