How to export from Blender to Unity3d? Part 2

Part 2. Fixing scale being reset to 0.01 on FBX import.

The solution is found on Unity forum. Ntero has written a nice script to set the default scale of asset importer to 1.

http://forum.unity3d.com/threads/64047-FBX-Import-make-default-scaling-to-0-01-an-option

Code:

using UnityEngine;
using UnityEditor;
using System;
//Sets our settings for all new Models and Textures upon first import
public class CustomImportSettings : AssetPostprocessor
{
public const float importScale= 1.0f;
void OnPreprocessModel()
{
ModelImporter importer = assetImporter as ModelImporter;
importer.globalScale = importScale;
importer.generateMaterials = ModelImporterGenerateMaterials.None;
}
}

Thanks, Ntero!

p.s. File name – CustomImportSettings.cs
Script should be put in AssetsEditor

Part 1: How to preserve pivot point (origin)?
Part 3: Fixing X axis rotation

 

5 comments

  1. Hi Gleb,

    How to name the file with extension, please? And where precisely to place it in Unity’s folder?
    Thanks for your reply.

  2. Anonymous

    File name: CustomImportSettings.cs
    Put it in AssetsEditor

  3. @Anonymous. Nice, thanks for the answer. I should add it to the post.
    @Spirou4D – and thanks for the question!

  4. The last line is deprecated, so I remove them.

Comments are closed.