Texture2D 二维纹理

Inherits from Texture

Class for texture handling. Use this to create textures on the fly or to modify existing texture assets.

纹理处理类。使用这个动态创建纹理或修改现有纹理资源。

Variables变量

  • mipmapCount
    How many mipmap levels are in this texture (Read Only).
    这个纹理有多少mipmap等级(只读)
  • format
    The format of the pixel data in the texture (Read Only).
    纹理中像素的数据格式(只读)  

Constructors构造器

  • Texture2D
    Create a new empty texture. // 创建一个新的空纹理

Functions函数

  • SetPixel
    Sets pixel color at coordinates (x,y). //        设置坐标(x,y)处的像素颜色
  • GetPixel
    Returns pixel color at coordinates (x, y). //        获取坐标(x,y)处的像素颜色
  • GetPixelBilinear
    Returns filtered pixel color at normalized coordinates (u, v).
          返回坐标(u,v)处的过滤化颜色
  • SetPixels
    Set a block of pixel colors. //        设置一块像素的颜色
  • SetPixels32
    Set a block of pixel colors. // 设置一个像素颜色块。
  • LoadImage
    Loads an image from a byte array. //        基于字节组信息载入图片
  • GetPixels
    Get a block of pixel colors. //        获取一块像素颜色
  • GetPixels32
    Get a block of pixel colors in Color32 format
       获取Color32格式的像素颜色块。
  • Apply
    Actually apply all previous SetPixel and SetPixels changes.
          实际应用前面的SetPixel和Setpixels的更改
  • Resize
    Resizes the texture.       // 调整纹理的大小
  • Compress
    Compress texture into DXT format. //        压缩纹理成为DXT格式
  • PackTextures
    Packs multiple textures into a texture atlas.
          打包多个纹理成为一个纹理集
  • ReadPixels
    Read screen pixels into the saved texture data.
          读取屏幕像素信息并存储为纹理数据
  • EncodeToPNG
    Encodes this texture into PNG format. //        将此纹理编码为PNG格式

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

  • width
    Width of the texture in pixels (Read Only)
    以像素为单位的贴图宽度 (只读)    
  • height
    Height of the texture in pixels (Read Only)
    以像素为单位的贴图的高度(只读)    
  • filterMode
    Filtering mode of the texture.
    贴图的过滤模式    
  • anisoLevel
    Anisotropic filtering level of the texture.
    贴图的各向异性等级。(增加等级意味着更好的贴图效果,但是会需要更大的开销,减小则减少开销,代价是较远处或侧面的贴图会变得模糊。)    
  • wrapMode
    Wrap mode (Repeat or Clamp) of the texture.
    循环模式 (重复或强制拉伸?)
  • mipMapBias
    Mip map bias of the texture.
    Mip贴图偏移    
  • name
    The name of the object. //物体的名字
  • hideFlags
    Should the object be hidden, saved with the scene or modifiable by the user?
       物体是否被隐藏、保存在场景中或被用户修改?

Inherited Functions继承函数

  • GetNativeTextureID
    Retrieve native ('hardware') handle to a texture
    检索本地纹理('硬件')    
  • GetInstanceID
    Returns the instance id of the object.
       返回物体的实例ID
  • ToString
    Returns the name of the game object.
    返回游戏物体的名称。

Inherited Class Functions继承类函数

  • 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.
        克隆原始物体,并返回克隆的物体
,