TextureImporter 纹理导入器

Inherits from AssetImporter

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

TextureImporter让你从编辑器脚本修改Texture2D导入设置。

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.
 注意:这是一个编辑器类,如果想使用它你需要把它放到工程目录下的Assets/Editor文件夹下。编辑器类在UnityEditor命名空间下。所以当使用C#脚本时,你需要在脚本前面加上 "using UnityEditor"引用。

Settings of this class match the ones exposed in Texture Import Settings.

这个类的设置匹配暴露在Texture Import检视面板中的设置。

Variables变量

  • textureFormat
    Format of imported texture.
       被导入纹理的格式。
  • maxTextureSize
    Maximum texture size.
       最大纹理大小。
  • grayscaleToAlpha
    Generate alpha channel from intensity?
       从灰度生成alpha通道?
  • generateCubemap
    Cubemap generation mode.
       立方图生成模式。
  • npotScale
    Scaling mode for non power of two textures.
       用于非二次幂纹理的缩放模式。
  • isReadable
    Is texture data readable from scripts.
       纹理数据从脚本是否可读?
  • mipmapEnabled
    Generate mip maps for the texture?
       用于纹理,生成mipmap?
  • borderMipmap
    Keep texture borders the same when generating mipmaps?
       当生成mipmap时,保持纹理边框相同?
  • correctGamma
    Should mip maps be generated with gamma correction?
       应否生成mipmap带有伽玛校正?
  • mipmapFilter
    Mipmap filtering mode.
       Mipmap过滤模式。
  • fadeout
    Fade out mip levels to gray color?
       淡出mip级别到灰色?
  • mipmapFadeDistanceStart
    Mip level where texture begins to fade out.
       Mip级别,在哪里纹理开始淡出。
  • mipmapFadeDistanceEnd
    Mip level where texture is faded out completely.
       Mip级别,在哪里纹理完全淡出。
  • convertToNormalmap
    Convert heightmap to normal map?
       转换高度图到法线贴图?
  • normalmap
    Is this texture a normal map?
       转换高度图到法线贴图?
  • normalmapFilter
    Normal map filtering mode.
       法线贴图过滤模式。
  • heightmapScale
    Amount of bumpyness in the heightmap.
       高度图中的凹凸数。
  • lightmap
    Is this texture a lightmap?
       这个纹理是光照贴图么?
  • anisoLevel
    Anisotropic filtering level of the texture.
       纹理的各向异性过滤等级。
  • filterMode
    Filtering mode of the texture.
       纹理的过滤模式。
  • wrapMode
    Wrap mode (Repeat or Clamp) of the texture.
       纹理的循环模式。
  • mipMapBias
    Mip map bias of the texture.
       纹理的Mip map偏移值。
  • textureType
    Which type of texture are we dealing with here
       在这里处理,纹理是哪种类型。

Functions函数

  • GetPlatformTextureSettings
    Get platform specific texture settings
       获取平台特定的纹理设置。
  • SetPlatformTextureSettings
    Set specific target platform settings
       设置特定目标平台纹理设置。
  • ClearPlatformTextureSettings
    Clear specific target platform settings
       清除特定目标平台纹理设置。
  • DoesSourceTextureHaveAlpha
    Does textures source image have alpha channel.
       源纹理的图像是否有alpha通道。
  • ReadTextureSettings
    Read texture settings into TextureImporterSettings class.
       在TextureImporterSettings类读取纹理设置。
  • SetTextureSettings
    Set texture importers settings from TextureImporterSettings class.
       从TextureImporterSettings类,设置纹理导入设置。

Inherited members继承成员Inherited Variables继承变量

  • assetPath
    The path name of the asset for this importer (Read Only)
        用于这个导入器,资源的路径名(只读)。
  • name
    The name of the object. //物体的名字
  • hideFlags
    Should the object be hidden, saved with the scene or modifiable by the user?
       物体是否被隐藏、保存在场景中或被用户修改?

Inherited Functions继承函数

  • GetInstanceID
    Returns the instance id of the object.
       返回物体的实例ID
  • ToString
    Returns the name of the game object.
    返回游戏物体的名称。

Inherited Class Functions继承类函数

  • GetAtPath
    Retrieves the asset importer for the asset at path.
        为所在路径的资源,导入器重新获取资源。
  • Destroy
    Removes a gameobject, component or asset.
       删除一个游戏物体、组件或资源
  • DestroyImmediate
    Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
       立即销毁物体obj,强烈建议使用Destroy代替。
  • DontDestroyOnLoad
    Makes the object target not be destroyed automatically when loading a new scene.
       加载新场景的时候使目标物体不被自动销毁。
  • FindObjectOfType
    Returns the first active loaded object of Type type.
       返回Type类型第一个激活的加载的物体。
  • FindObjectsOfType
    Returns a list of all active loaded objects of Type type.
       返回Type类型的所有激活的加载的物体列表
  • Instantiate
    Clones the object original and returns the clone.
       克隆原始物体,并返回克隆的物体
,