Version: 5.6

Texture2D.CreateExternalTexture

매뉴얼로 전환
public static Texture2D CreateExternalTexture (int width, int height, TextureFormat format, bool mipmap, bool linear, IntPtr nativeTex);

파라미터

nativeTex Native 2D texture object.
width Width of texture in pixels.
height Height of texture in pixels.
format Format of underlying texture object.
mipmap Does the texture have mipmaps?
linear Is texture using linear color space?

설명

Creates Unity Texture out of externally created native texture object.

This function is mostly useful for native code plugins that create platform specific texture objects outside of Unity, and need to use these textures in Unity scenes. It is also possible to create a texture in Unity and get a pointer to the underlying platform representation; see Texture.GetNativeTexturePtr.

Parameters passed to CreateExternalTexture should match what the texture actually is; and the underlying texture should be 2D (Cubemaps or 3D textures will not work).

Native texture object on Direct3D-like devices is a pointer to the base type, from which a texture can be created (IDirect3DBaseTexture9 on D3D9, ID3D11ShaderResourceView on D3D11). On OpenGL/OpenGL ES it is GLuint. On Metal it is id<MTLTexture>.

See Also: UpdateExternalTexture, Texture.GetNativeTexturePtr.