Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ModelImporter

Model importer lets you modify model import settings from editor scripts.
Read time 9 minutesLast updated 2 days ago

Definition

public class ModelImporter : AssetImporter

Remarks

Settings of this class match the ones exposed in Model tab Import Settings.

Properties

Property

Description

addColliderAdd mesh colliders to imported meshes.
animationCompressionAnimation compression setting.
animationPositionErrorAllowed error of animation position compression.
animationRotationErrorAllowed error of animation rotation compression.
animationScaleErrorAllowed error of animation scale compression.
animationTypeAnimator generation mode.
animationWrapModeThe default wrap mode for the generated animation clips.
autoGenerateAvatarMappingIfUnspecifiedGenerate auto mapping if no avatarSetup is provided when importing humanoid animation.
avatarSetupThe Avatar generation of the imported model.
bakeAxisConversionComputes the axis conversion on geometry and animation for Models defined in an axis system that differs from Unity's (left handed, Z forward, Y-up).
bakeIKBake Inverse Kinematics (IK) when importing.
clipAnimationsAnimation clips to split animation into. Additional Resources: ModelImporterClipAnimation.
defaultClipAnimationsGenerate a list of all default animation clip based on TakeInfo.
extraExposedTransformPathsAnimation optimization setting.
extraUserPropertiesA list of default FBX properties to treat as user properties during OnPostprocessGameObjectWithUserProperties.
fileScaleScaling factor used when useFileScale is set to true (Read-only).
generateAnimationsAnimation generation options.
generateMeshLodsIf true, Unity generates Mesh LOD levels for this mesh during import.
generateSecondaryUVGenerate secondary UV set for lightmapping.
globalScaleGlobal scale factor for importing.
humanDescriptionThe human description that is used to generate an Avatar during the import process.
humanoidOversamplingControls how much oversampling is used when importing humanoid animations for retargeting.
importAnimatedCustomPropertiesImport animated custom properties from file.
importAnimationImport animation from file.
importBlendShapeDeformPercentImport BlendShapes deform percent.
importBlendShapeNormalsBlend shape normal import options.
importBlendShapesControls import of BlendShapes.
importCamerasControls import of cameras. Basic properties like field of view, near plane distance and far plane distance can be animated.
importConstraintsImport animation constraints.
importedTakeInfosGenerates the list of all imported take.
importLightsControls import of lights. Note that because light are defined differently in DCC tools, some light types or properties may not be exported. Basic properties like color and intensity can be animated.
importNormalsVertex normal import options.
importTangentsVertex tangent import options.
importUVsDetermines which UV channels are imported from the source model.
importVertexColorsImports the vertex color channel from the source model.
importVisibilityUse visibility properties to enable or disable MeshRenderer components.
indexFormatFormat of the imported mesh index buffer data.
isBakeIKSupportedIs Bake Inverse Kinematics (IK) supported by this importer.
isReadableAre mesh vertices and indices accessible from script?
isTangentImportSupportedIs import of tangents supported by this importer.
isUseFileUnitsSupportedIs useFileUnits supported for this asset.
keepQuadsIf this is true, any quad faces that exist in the mesh data before it is imported are kept as quads instead of being split into two triangles, for the purposes of tessellation. Set this to false to disable this behavior.
materialImportModeMaterial creation options.
materialLocationMaterial import location options.
materialNameMaterial naming setting.
materialSearchExisting material search setting.
maxBonesPerVertexThe maximum number of bones per vertex stored in this mesh data.
maximumMeshLodThe maximum LOD level index after which the mesh generation stops.
meshCompressionMesh compression setting.
meshLodGenerationFlagsThe importer uses these Mesh LOD generation flags if Mesh LOD generation is enabled for this mesh.
meshOptimizationFlagsOptions to control the optimization of mesh data during asset import.
minBoneWeightMinimum bone weight to keep.
motionNodeNameThe path of the transform used to generation the motion of the animation.
normalCalculationModeNormal generation options for ModelImporter.
normalSmoothingAngleSmoothing angle (in degrees) for calculating normals.
normalSmoothingSourceSource of smoothing information for calculation of normals.
optimizeBonesOnly import bones where they are connected to vertices.
optimizeGameObjectsAnimation optimization setting.
optimizeMeshPolygonsOptimize the order of polygons in the mesh to make better use of the GPUs internal caches to improve rendering performance.
optimizeMeshVerticesOptimize the order of vertices in the mesh to make better use of the GPUs internal caches to improve rendering performance.
preserveHierarchyIf true, always create an explicit Prefab root. Otherwise, if the model has a single root, it is reused as the Prefab root.
referencedClipsReturns the matching referenced clip assets for this model.
removeConstantScaleCurvesRemoves constant animation curves with values identical to the object initial scale value.
resampleCurvesIf set to false, the importer will not resample curves when possible. Read more about animation curve resampling.
searchTexturesGloballyControls whether the importer searches the entire project for textures.
secondaryUVAngleDistortionThreshold for angle distortion (in degrees) when generating secondary UV.
secondaryUVAreaDistortionThreshold for area distortion when generating secondary UV.
secondaryUVHardAngleHard angle (in degrees) for generating secondary UV.
secondaryUVMarginMethodMethod to use for handling margins when generating secondary UV.
secondaryUVMinLightmapResolutionThe minimum lightmap resolution in texels per unit that the associated model is expected to have.
secondaryUVMinObjectScaleThe minimum object scale that the associated model is expected to have.
secondaryUVPackMarginMargin to be left between charts when packing secondary UV.
skinWeightsSkin weights import options.
sortHierarchyByNameSorts the gameObject hierarchy by name.
sourceAvatarImports the HumanDescription from the given Avatar.
strictVertexDataChecksEnables strict checks on imported vertex data.
swapUVChannelsSwap primary and secondary UV channels when importing.
transformPathsGenerates the list of all imported Transforms.
useFileScaleUse FileScale when importing.
useFileUnitsDetect file units and import as 1FileUnit=1UnityUnit, otherwise it will import as 1cm=1UnityUnit.
useSRGBMaterialColorWhen disabled, imported material albedo colors are converted to gamma space. This property should be disabled when using linear color space in Player rendering settings. The default value is true.
weldVerticesCombine vertices that share the same position in space.

Methods

Method

Description

CreateDefaultMaskForClipCreates a mask that matches the model hierarchy, and applies it to the provided ModelImporterClipAnimation.
ExtractTexturesExtracts the embedded textures from a model file (such as FBX or SketchUp).
HasPreBakeCollisionMeshChecks if collision mesh data of the specified type should be pre-baked during player build for all imported meshes.
SearchAndRemapMaterialsSearch the project for matching materials and use them instead of the internal materials.
SetPreBakeCollisionMeshEnables or disables pre-baking of collision mesh data during player build for all imported meshes.

Static Methods

Method

Description

GetReferencedClipsForModelPathReturns all the referenced clips matching the given model name.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.