创建一个新的空纹理。
纹理大小为 width
x /height/,采用 RGBA32 TextureFormat,具有多级渐进纹理,使用 sRGB 颜色空间。
在创建该纹理后,
您通常需要使用 SetPixel、SetPixels 和 Apply 函数设置该纹理的颜色。
// Create a new texture and assign it to the renderer's material
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
void Start()
{
Texture2D texture = new Texture2D(128, 128);
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = texture;
}
}
创建一个新的空纹理。
纹理大小为 width
x /height/,采用给定的 /format/,具有或不具有多级渐进纹理。
在创建该纹理后,
您通常需要使用 SetPixel、SetPixels 和 Apply 函数设置该纹理的颜色。
另请参阅:SetPixel、SetPixels、Apply 函数。
创建一个新的空纹理。