How to make Maya rigs play nice with Unity and Unreal Engine 4.

Article / 17 June 2017
This will be a quick article. I've been importing rigged characters into Unity and Unreal Engine 4 for more than a year, and I've experienced all kind of problems. The most disturbing one though, was getting an extremely huge/small, broken mesh like the one you can see in the picture below. Or similar. The purpose of this article is to help out people encountering the same issue, since there is not much information online, and it's quite hard to find.

If you are getting this error when exporting from Maya and your model is broken in Unity/UE4; "ImportFBX Warnings: File contains 23..." You have to take a look at every joint that Unity or Maya names in the error log, select it in Maya, and go to Attribute Editor (CTRL+A for win) and under the "Joint" section, turn "Segment Scale Compensate" off.
If the amount of joints you have in the log is extremely huge you can use a MEL script. Just select all the joints and the script will be turning SSC off for all of them.
string $selected[] = `ls -type joint`;
select -r $selected;

string $sel[] = `ls -sl`;
string $singleJnt;
for ($singleJnt in $sel)
setAttr ($singleJnt + ".segmentScaleCompensate") 0;

If you wish to expand your knowledge in this area, further information can be found in the Autodesk Knowledge Network, where I got the MEL script: Turning Off Segment Scale Compensate in Maya.

Image was taken from: This thread.