Batch Importing & AssetDatabase Optimization
Learn how DataLoom bypasses Unity Editor database overhead during bulk sheet processing.
The Bottleneck: Disk updates on every asset
Calling AssetDatabase.CreateAsset() in a loop causes Unity to write to the disk, trigger script compilation checks, and refresh the project folder layout on every single asset. For 1000 items, this can take several minutes.
The Solution: Suspended Database Refreshes
DataLoom handles bulk changes inside a scope called AssetDatabaseBatch.
- It calls
AssetDatabase.StartAssetEditing()when starting. - This alerts Unity to freeze script reloads and directory tracking updates.
- After generating/updating all ScriptableObject files in memory, it calls
AssetDatabase.StopAssetEditing()to write and save all files in a single batch.
This reduces import times from minutes to a few seconds.