Legacy Documentation: Version 5.4
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

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

Sumbission failed

For some reason your suggested change could not be submitted. Please try again 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 match the ones exposed in Texture Import Settings.

Variables

anisoLevelAnisotropic filtering level of the texture.
borderMipmapKeep texture borders the same when generating mipmaps?
compressionQualityQuality of Texture Compression in the range [0..100].
convertToNormalmapConvert heightmap to normal map?
fadeoutFade out mip levels to gray color?
filterModeFiltering mode of the texture.
generateCubemapCubemap generation mode.
generateMipsInLinearSpaceShould mip maps be generated with gamma correction?
grayscaleToAlphaGenerate alpha channel from intensity?
heightmapScaleAmount of bumpyness in the heightmap.
isReadableIs texture data readable from scripts.
lightmapIs this texture a lightmap?
linearTextureIs texture storing non-color data?
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.
normalmapIs this texture a normal map?
normalmapFilterNormal map filtering mode.
npotScaleScaling mode for non power of two textures.
qualifiesForSpritePackingReturns true if this TextureImporter is setup for Sprite packing.
spriteBorderBorder sizes of the generated sprites.
spriteImportModeSelects Single or Manual import mode for Sprite textures.
spritePackingTagSelects the Sprite packing tag.
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.
spritesheetArray representing the sections of the atlas corresponding to individual sprite graphics.
textureFormatFormat of imported texture.
textureTypeWhich type of texture are we dealing with here.
wrapModeWrap mode (Repeat or Clamp) of the texture.

Public Functions

ClearPlatformTextureSettingsClear specific target platform settings.
DoesSourceTextureHaveAlphaDoes textures source image have alpha channel.
GetAllowsAlphaSplittingGetter for the flag that allows Alpha splitting on the imported texture when needed (for example ETC1 compression for textures with transparency).
GetPlatformTextureSettingsGet platform specific texture settings.
ReadTextureImportInstructionsReads the active texture output instructions of this TextureImporter.
ReadTextureSettingsRead texture settings into TextureImporterSettings class.
SetAllowsAlphaSplittingSetter for the flag that allows Alpha splitting on the imported texture when needed (for example ETC1 compression for textures with transparency).
SetPlatformTextureSettingsSet specific target platform settings.
SetTextureSettingsSet texture importers settings from TextureImporterSettings class.

Inherited members

Variables

assetBundleNameGet or set the AssetBundle name.
assetBundleVariantGet or set the AssetBundle variant.
assetPathThe path name of the asset for this importer. (Read Only)
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 Functions

SaveAndReimportSave asset importer settings if asset importer is dirty.
SetAssetBundleNameAndVariantSet the AssetBundle name and variant.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the game object.

Static Functions

GetAtPathRetrieves the asset importer for the asset at path.
DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately.
DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateReturns a copy of the object original.

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.