Version: Unity 6 Preview (6000.0)
LanguageEnglish
  • C#

TextureImporter

class in UnityEditor

/

Inherits from:AssetImporter

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

Texture importer lets you modify Texture2D import settings from editor scripts.

Settings of this class cover most of the settings exposed in Texture Import Settings. Some settings require you to use TextureImporterSettings. Refer to TextureImporter.SetTextureSettings).

Properties

allowAlphaSplittingAllows alpha splitting on relevant platforms for this texture.
alphaIsTransparencyIf the alpha channel of your texture represents transparency, enable this property to dilate the color channels of visible texels into fully transparent areas. This effectively adds padding around transparent areas that prevents filtering artifacts from forming on their edges. Unity does not support this property for HDR textures.This property makes the color data of invisible texels undefined. Disable this property to preserve invisible texels' original color data.
alphaSourceSelect how the alpha of the imported texture is generated.
alphaTestReferenceValueReturns or assigns the alpha test reference value.
androidETC2FallbackOverrideETC2 texture decompression fallback override on Android devices that don't support ETC2.
anisoLevelAnisotropic filtering level of the texture.
borderMipmapKeeps texture borders the same when generating mipmaps.
compressionQualityThe quality of Crunch texture compression. The range is 0 through 100. A higher quality means larger textures and longer compression times.
convertToNormalmapConvert heightmap to normal map
crunchedCompressionUse crunched compression when available.
fadeoutFade out mip levels to gray color.
filterModeFiltering mode of the texture.
flipGreenChannelIndicates whether to invert the green channel values of a normal map.
generateCubemapCubemap generation mode.
heightmapScaleAmount of bumpyness in the heightmap.
ignoreMipmapLimitEnable this flag for textures that should ignore mipmap limit settings.
ignorePngGammaIgnore the Gamma attribute in PNG files. This property does not effect other file formats.
isReadableWhether Unity stores an additional copy of the imported texture's pixel data in CPU-addressable memory.
maxTextureSizeMaximum texture size.
mipMapBiasMip map bias of the texture.
mipmapEnabledGenerate Mip Maps.
mipmapFadeDistanceEndMip level where texture is faded out completely.
mipmapFadeDistanceStartMip level where texture begins to fade out.
mipmapFilterMipmap filtering mode.
mipmapLimitGroupNameName of the texture mipmap limit group to which this texture belongs.
mipMapsPreserveCoverageEnables or disables coverage-preserving alpha mipmapping.
normalmapFilterNormal map filtering mode.
npotScaleScaling mode for non power of two textures.
qualifiesForSpritePackingReturns true if this TextureImporter is setup for Sprite packing.
secondarySpriteTexturesSecondary textures for the imported Sprites.
spriteBorderBorder sizes of the generated sprites.
spriteImportModeSelects Single or Manual import mode for Sprite textures.
spritePivotThe point in the Sprite object's coordinate space where the graphic is located.
spritePixelsPerUnitThe number of pixels in the sprite that correspond to one unit in world space.
sRGBTextureWhether this texture stores data in sRGB (also called gamma) color space.
streamingMipmapsEnable mipmap streaming for this texture.
streamingMipmapsPriorityRelative priority for this texture when reducing memory size in order to hit the memory budget.
swizzleASpecifies the source for the texture's alpha color channel data.
swizzleBSpecifies the source for the texture's blue color channel data.
swizzleGSpecifies the source for the texture's green color channel data.
swizzleRSpecifies the source for the texture's red color channel data.
textureCompressionCompression of imported texture.
textureShapeThe shape of the imported texture.
textureTypeWhich type of texture are we dealing with here.
vtOnlyWhen enabled, this texture can solely be used in combination with a Texture Stack for Virtual Texturing. When enabled the texture is not guaranteed to be available as a Texture2D in the Player (e.g., not accessible from a script). When disabled, the Player includes the texture both as a Texture2D (e.g., accessible from script) and as a streamable texture in a Texture Stack.
wrapModeTexture coordinate wrapping mode.
wrapModeUTexture U coordinate wrapping mode.
wrapModeVTexture V coordinate wrapping mode.
wrapModeWTexture W coordinate wrapping mode for Texture3D.

Public Methods

ClearPlatformTextureSettingsClears specific target platform settings.
DoesSourceTextureHaveAlphaAllows you to check whether the texture source image has an alpha channel.
GetAutomaticFormatReturns the TextureImporterFormat that would be automatically chosen for this platform.
GetDefaultPlatformTextureSettingsGets the default platform specific texture settings.
GetPlatformTextureSettingsGets platform specific texture settings.
GetSourceTextureWidthAndHeightGets the source texture's width and height.
ReadTextureImportInstructionsReads the active texture output instructions of this TextureImporter.
ReadTextureSettingsRead texture settings into TextureImporterSettings class.
SetPlatformTextureSettingsSets specific target platform settings.
SetTextureSettingsSets texture importers settings from TextureImporterSettings class.

Static Methods

IsDefaultPlatformTextureFormatValidValidates TextureImporterFormat based on the type of the current format (TextureImporterType) and the default platform.
IsPlatformTextureFormatValidValidates TextureImporterFormat based on a specified import type (TextureImporterType) and a specified build target (BuildTarget.).

Inherited Members

Properties

assetBundleNameGet or set the AssetBundle name.
assetBundleVariantGet or set the AssetBundle variant.
assetPathThe path name of the asset for this importer. (Read Only)
importSettingsMissingThe value is true when no meta file is provided with the imported asset.
userDataGet or set any user data.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Methods

AddRemapMap a sub-asset from an imported asset (such as an FBX file) to an external Asset of the same type.
GetExternalObjectMapGets a copy of the external object map used by the AssetImporter.
RemoveRemapRemoves an item from the map of external objects.
SaveAndReimportSave asset importer settings if asset importer is dirty.
SetAssetBundleNameAndVariantSet the AssetBundle name and variant.
SupportsRemappedAssetTypeChecks if the AssetImporter supports remapping the given asset type.
GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static Methods

GetAtPathRetrieves the asset importer for the asset at path.
GetImportLogRetrieves logs generated during the import of the asset at path.
DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
InstantiateAsyncCaptures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.