Version: 5.3

Texture2D.GetRawTextureData

매뉴얼로 전환
public byte[] GetRawTextureData ();

반환

byte[] Raw texture data as a byte array.

설명

Get raw data from a texture.

This function returns the raw texture data as a byte array, which you can then use with Texture2D.LoadRawTextureData. This allows you to serialize and load textures of any format (including compressed ones), and to load them back into a texture later.

using UnityEngine;

class CopyTexture: MonoBehaviour { // the source texture. Texture2D tex;

void Start() { // Create a copy of the texture by reading and applying the raw texture data. Texture2D texCopy = new Texture2D(tex.width, tex.height, tex.format, tex.mipmapCount > 1); texCopy.LoadRawTextureData(tex.GetRawTextureData()); texCopy.Apply (); } }