- Home /
Unity5 File Scale
I am trying to write a script, that corrects the scaling when exporting 3D-Meshes from Blender to Unity via FBX. This worked fine until now, when with unity5 the file scale option was introduced in the unity importer. The file scale cannot be set, instead it is determined automatically.
And here is the problem: The file scale for some objects is 0.01 and for others it is 1. After some playing around, I found different file scales for identical copies of the same fbx file!
Does anybody have an idea how to predict the file scale?
Turns out, it is a read only proprter of the $$anonymous$$odelImporter.
There has always been a scale option for imported models, but yes FBX files can come in as read only, does this mean it's no longer an issue for your script? Generally the number set depends on the units set in your 3D package - for example if you units are set to metres in 3DS $$anonymous$$ax then the objects come in at scale = 1 - if you use cm in $$anonymous$$aya they come in at 0.01 - I presume the same is the case with Blender so check the scale units used in preferences and the individual files. If this is still inconsistent you can file a bug.
Answer by Ghisallo · Mar 27, 2015 at 05:15 PM
This is too late to help, I'm sure, but you might try something like this editor script:
using UnityEditor;
public class ImportSettings : AssetPostprocessor
{
public void OnPreprocessModel()
{
ModelImporter modelImporter = (ModelImporter) assetImporter;
modelImporter.globalScale = 1f/modelImporter.fileScale; // ensures the scale in the scene is equal to 1
}
}
Thanks for your help! The problem is not yet solved, since the project is currently frozen. This method has the downside though, that it is no longer possible for the level designer to manually set the scale of an object. Our current solution is to rescale all vertices on load to compensate for this, however this is also not perfect, because importing nested objects messes up their relative positions.
Answer by Brozef · Aug 03, 2015 at 07:15 PM
This editor script was absolutely useless for me it didn't affect any imported file. Instead follow this link and change each files meta data using Notepad, this trick worked perfectly for me.
Answer by torbenmedt1231242354 · Dec 02, 2015 at 11:58 AM
If you export from Maya you can fix it using a couple of MEL commands.
These 2 did the trick for me.
FBXExportConvertUnitString m; FBXExportScaleFactor 100;
Your answer
![](https://koobas.hobune.stream/wayback/20220613170806im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
FBX Scale Wobble/Shake problem 0 Answers
Child prefab Scale on inspector becoming( 1,1,1) while playing 2 Answers
Objects from Blender (FBX Exported) are scaled wrong. 4 Answers
FBX import scale factor issue 1 Answer
Maya fbx to unity scale problem 1 Answer