Batch GLB export from Blender is one of those workflow improvements that pays back its setup cost the moment you hit a scene with 30 props. Manually exporting each asset one at a time — navigating menus, typing filenames, confirming settings — burns hours that belong in the engine. A single Python script automates the whole process: one collection per file, consistent transform application, correct settings, repeatable every build.
Why batch export matters for indie game pipelines
![]()
Most indie teams underestimate the compounding cost of manual export. Ten assets today, fifty next sprint, a hundred by alpha. Each manual export introduces variance: a forgotten Apply Transforms step leaves a mesh rotated 90° in Unity; a mistyped filename breaks a Godot import preset; a changed export setting silently strips material names. Scripted batch export eliminates all of that.
The key advantages:
- Consistency — every GLB uses the same export flags, no per-asset drift
- Speed — exporting 80 props takes seconds instead of an afternoon
- CI-friendliness — run the script headless from a build pipeline (`blender --background --python export.py`)
- Error surfacing — failed exports are logged, not silently skipped
The BitSoul marketplace ships 747 GLB-format assets — the same format this workflow targets. Drop downloaded assets into a Blender scene, modify them, then re-export with your project's exact settings in one run.
Setting up the Blender Python environment for GLB export
Blender's scripting workspace exposes the full `bpy` API. No external packages needed — GLB export is built into `bpy.ops.export_scene.gltf`. Open the Scripting workspace, create a new text block, and you're ready.
Before writing the script, decide on your collection-per-asset convention. The approach below treats each top-level collection as one exported GLB file. Nest all objects for a prop (mesh, armature, collision proxy, empties) under a single collection named after the asset:
```
Scene Collection
├── SM_Crate_Wood (mesh + UCX_ collision child)
├── SM_Barrel_Metal (mesh)
└── SM_Table_Oak (mesh + LOD1 child)
```
Writing the batch export script
The decisive logic is a single `export_collection` function. Set `OUTPUT_DIR` to a path relative to your `.blend` (e.g. `//export/`) and flip `APPLY_MODIFIERS` or `EXPORT_TEXTURES` as needed. The outer loop iterates `bpy.context.scene.collection.children`, skips collections whose name starts with `EXCLUDE_PREFIX`, calls the function below, and logs `[OK]` or `[ERR]` per asset.
```python
import bpy, os
OUTPUT_DIR = "//export/" # relative to .blend
EXCLUDE_PREFIX = "_" # collections starting with _ are skipped
APPLY_MODIFIERS = True
EXPORT_TEXTURES = True
def export_collection(col, out_dir):
filepath = os.path.join(out_dir, col.name + ".glb")
bpy.ops.object.select_all(action='DESELECT')
for obj in col.all_objects:
if obj.type in {'MESH', 'ARMATURE', 'EMPTY'}:
obj.select_set(True)
if APPLY_MODIFIERS:
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.ops.export_scene.gltf(
filepath=filepath, use_selection=True, export_format='GLB',
export_apply=APPLY_MODIFIERS, export_yup=True,
export_image_format='AUTO' if EXPORT_TEXTURES else 'NONE',
)
return filepath
```
Key export flags:
| Flag | Value | Why |
|---|---|---|
| `export_yup` | `True` | GLB spec and Unity/UE5/Godot use Y-up |
| `export_apply` | `True` | Bakes modifiers before export |
| `export_format` | `'GLB'` | Single binary file, not glTF+bin+textures |
| `export_image_format` | `'AUTO'` | Keeps PNG/JPEG as-is; avoids unnecessary re-encode |
| `export_draco_mesh_compression_enable` | `False` | Most game engines don't support Draco at runtime |
Run the script headless — no Blender GUI required — via `blender my_assets.blend --background --python batch_export.py 2>&1 | tee export_log.txt`. Pipe to a log file for CI pipelines.
Integrating batch export into Unity and Unreal Engine 5 import pipelines
![]()
The script drops files into a flat `export/` directory. For engine integration, extend the `OUTPUT_DIR` logic to mirror your project's asset folder structure.
Unity: point `OUTPUT_DIR` at `Assets/Models/Props/`. Unity's Auto Refresh picks up new GLBs immediately. Pair with an `AssetPostprocessor` script to enforce import settings (Read/Write disabled, Generate Lightmap UVs on, mesh compression to High) automatically on every new file.
Unreal Engine 5: UE5 doesn't watch arbitrary folders, so trigger an Interchange import via Python after export. Inside an Editor Utility, create an `unreal.AssetImportTask()`, set `task.automated = True` and `task.destination_path = '/Game/Props/'`, then call `unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])` for each `.glb` in your export directory.
Godot 4: GLB files placed under `res://` are auto-imported. Add a `.import` override file per asset to lock settings (e.g. `generate/shadow_meshes=true`), then commit both the GLB and its `.import` to version control so team members don't see reimport prompts.
Checklist before running the script on a full scene
- [ ] All asset collections follow the `SM_AssetName` naming convention
- [ ] Collections to skip are prefixed with `_`
- [ ] No unapplied scale on root objects (check with `N` panel → Item → Scale = 1,1,1 before applying)
- [ ] All textures are packed into the .blend (`File → External Data → Pack All Into .blend`)
- [ ] Output directory path is correct and writable
- [ ] Blend file is saved (relative paths like `//export/` resolve from the .blend location)
Batch export scripts are one of the highest-ROI automation investments for any 3D game pipeline. Set it up once, run it every build, and stop thinking about export settings forever. Browse the BitSoul marketplace for production-ready GLB assets compatible with this exact workflow.
---
*This post is part of the Ultimate Guide to Free 3D Game Assets — BitSoul's complete reference for formats, texturing, rigging, optimization, and engine integration.*