How can I make a custom fbx exporter for unity?
you can make steps automatic
1.rotate the object by -90 degree around X-axis
obj.rotation_euler = (math.radians(-90),0,0)

2.press Ctrl + A and Apply =&gt; Rotation
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)

3.and set X rotation to 90 degrees
(do not apply this time)
obj.rotation_euler = (math.radians(-90),0,0)

also, you can export it by unit scale
bl_info = {
    &quot;name&quot;: &quot;Unity Fix&quot;,
    &quot;author&quot;: &quot;Kamali&quot;,
    &quot;version&quot;: (1, 0),
    &quot;blender&quot;: (2, 80, 0),
    &quot;location&quot;: &quot;File &gt; Export &gt; Export For Unity&quot;,
    &quot;description&quot;: &quot;Fix Pivot ,Location , Rotation , Scale &quot;,
    &quot;warning&quot;: &quot;&quot;,
    &quot;doc_url&quot;: &quot;&quot;,
    &quot;category&quot;: &quot;&quot;,
}


import bpy
import math

def write_some_data(context, filepath):
    bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_MASS', center='MEDIAN')
    obj= context.object
    
    # reset location to the center
    obj.location = (0,0,0)
    
    # reset everything to make sure it won't change
    bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
    # set rotation to -90
    
    obj.rotation_euler = (math.radians(-90),0,0)
    # reset everything
    bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
    
    # rotate 90 degree along x axis
    obj.rotation_euler = (math.radians(90),0,0)
    
    
    # apply unit scaling
    bpy.ops.export_scene.fbx(filepath=filepath, use_selection=True,apply_scale_options='FBX_SCALE_UNITS',apply_unit_scale=True)
    return {'FINISHED'}

    


from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import Operator


class ExportSomeData(Operator, ExportHelper):
    &quot;&quot;&quot;Export For Unity&quot;&quot;&quot;
    bl_idname = &quot;export_test.some_data&quot;  
    bl_label = &quot;Export For Unity&quot;


    filename_ext = &quot;.fbx&quot;

    filter_glob: StringProperty(
        default=&quot;*.fbx&quot;,
        options={'HIDDEN'},
        maxlen=255, 
    )


    def execute(self, context):
        return write_some_data(context, self.filepath)


# Only needed if you want to add into a dynamic menu
def menu_func_export(self, context):
    self.layout.operator(ExportSomeData.bl_idname, text=&quot;Export For Unity&quot;)


def register():
    bpy.utils.register_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.append(menu_func_export)


def unregister():
    bpy.utils.unregister_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)


if __name__ == &quot;__main__&quot;:
    register()