Use IHVImageFormatImporter to modify Texture2D import settings for Textures in IHV (Independent Hardware Vendor) formats from Editor scripts. These formats allow you to import raw texture data and bypass Unity's texture importer, allowing pixel data which might be compressed by an external tool to be converted to a Texture. IHVImageFormatImporter supports the following file formats:
File Format Support Notes:
Unity's support for these formats is limited to features that provide essential functionality, with a focus on importing raw compressed texture and pixel data into Unity. Some of the advanced information and metadata stored in these formats may be ignored by Unity. If you encounter import problems, it can be useful to use a different export tool, because the formats are usually output by third-party export tools which interpret the data in different ways.
Some limitations of Unity's graphics stack also apply to all these formats:
The following is a list of format specific limitations. Familiarity with each format is required to understand these limitations.
PVR
Supports format version 2 and 3.
Supports Texture2D (with optional mipmaps) only, no volume array or cubemaps.
Color space, alpha premultiplication and channel type are ignored and set to Unity's defaults.
Supported formats for v2:
The PVR v2 format enum and the mapped Unity format.
* MGLPT_PVRTC2,OGL_PVRTC2: if alpha TextureFormat.PVRTC_RGBA2 else TextureFormat.PVRTC_RGB2
* MGLPT_PVRTC4,OGL_PVRTC4: if alpha TextureFormat.PVRTC_RGBA4 else TextureFormat.PVRTC_RGB4
* MGLPT_RGB_888,OGL_RGB_888: TextureFormat.RGB24
* MGLPT_RGB_565,OGL_RGB_565: TextureFormat.RGB565
* D3D_DXT1: TextureFormat.DXT1
* D3D_DXT5: TextureFormat.DXT5
* ETC_RGB_4BPP: TextureFormat.ETC_RGB4
* OGL_RGBA_8888: TextureFormat.RGBA32
* MGLPT_ARGB_4444: TextureFormat.ARGB4444
* OGL_RGBA_4444: TextureFormat.RGBA4444
Supported formats for v3:
The PVR v3 format ID and the mapped Unity format.
* Id 0: TextureFormat.PVRTC_RGB2
* Id 1: TextureFormat.PVRTC_RGBA2
* Id 2: TextureFormat.PVRTC_RGB4
* Id 3: TextureFormat.PVRTC_RGBA4
* Id 6: TextureFormat.ETC_RGB4
* Id 7: TextureFormat.DXT1
* Id 11: TextureFormat.DXT5
* Id 22: TextureFormat.ETC2_RGB
* Id 23: TextureFormat.ETC2_RGBA8
* Id 24: TextureFormat.ETC2_RGBA1
* Id 25: TextureFormat.EAC_R
* Id 26: TextureFormat.EAC_RG
* Id 27: TextureFormat.ASTC_4x4
* Id 29: TextureFormat.ASTC_5x5
* Id 31: TextureFormat.ASTC_6x6
* Id 34: TextureFormat.ASTC_8x8
* Id 38: TextureFormat.ASTC_10x10
* Id 40: TextureFormat.ASTC_12x12
The following formats specified in the PVR file through a channel order and bitwidth are also supported:
ASTC
Supports Texture2D (with no mipmaps) only, no volume support.
Supports only 4x4 5x5 6x6 8x8 10x10 12x12 astc block sizes.
KTX
Supports Texture2D (with optional mipmaps) only, no volume array or cubemaps.
Only the older KTX v1 format is supported.
sRGB settings of the texture formats are ignored.
Supported formats:
DDS
Supports Texture2D and CubeMap (with optional mipmaps) only, no volume, array or cubemap arrays.
BC7 data cannot be flipped on import. Because of its compression format, Unity imports it upside down.
Supported formats:
DX10 Style formats:
FOURCC & DX9 Style formats:
Bit packed RGB formats (bitcount + mask):
Luminance Alpha Formats:
Property | Description |
---|---|
filterMode | Filtering mode of the texture. |
ignoreMipmapLimit | Enable if the texture should ignore any texture mipmap limit settings set in the Project Settings. |
isReadable | Is texture data readable from scripts. |
mipmapLimitGroupName | Name of the texture mipmap limit group to which this texture belongs. |
streamingMipmaps | Enable mipmap streaming for this texture. |
streamingMipmapsPriority | Relative priority for this texture when reducing memory size in order to hit the memory budget. |
wrapMode | Texture coordinate wrapping mode. |
wrapModeU | Texture U coordinate wrapping mode. |
wrapModeV | Texture V coordinate wrapping mode. |
wrapModeW | Texture W coordinate wrapping mode for Texture3D. |
Property | Description |
---|---|
assetBundleName | Get or set the AssetBundle name. |
assetBundleVariant | Get or set the AssetBundle variant. |
assetPath | The path name of the asset for this importer. (Read Only) |
importSettingsMissing | The value is true when no meta file is provided with the imported asset. |
userData | Get or set any user data. |
hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
name | The name of the object. |
Method | Description |
---|---|
AddRemap | Map a sub-asset from an imported asset (such as an FBX file) to an external Asset of the same type. |
GetExternalObjectMap | Gets a copy of the external object map used by the AssetImporter. |
RemoveRemap | Removes an item from the map of external objects. |
SaveAndReimport | Save asset importer settings if asset importer is dirty. |
SetAssetBundleNameAndVariant | Set the AssetBundle name and variant. |
SupportsRemappedAssetType | Checks if the AssetImporter supports remapping the given asset type. |
GetInstanceID | Gets the instance ID of the object. |
ToString | Returns the name of the object. |
Method | Description |
---|---|
GetAtPath | Retrieves the asset importer for the asset at path. |
GetImportLog | Retrieves logs generated during the import of the asset at path. |
Destroy | Removes a GameObject, component, or asset. |
DestroyImmediate | Destroys the specified object immediately. Use with caution and in Edit mode only. |
DontDestroyOnLoad | Do not destroy the target Object when loading a new Scene. |
FindAnyObjectByType | Retrieves any active loaded object of Type type. |
FindFirstObjectByType | Retrieves the first active loaded object of Type type. |
FindObjectsByType | Retrieves a list of all loaded objects of Type type. |
Instantiate | Clones the object original and returns the clone. |
InstantiateAsync | Captures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation. |
Operator | Description |
---|---|
bool | Does 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. |