Version: 2018.1
public static Texture2D CreateExternalTexture (int width, int height, TextureFormat format, bool mipmap, bool linear, IntPtr nativeTex);

パラメーター

nativeTexネイティブの 2D テクスチャオブジェクト
widthピクセル単位でのテクスチャの幅
heightピクセル単位でのテクスチャの高さ
format下地となるテクスチャオブジェクトの形式
mipmapテクスチャにミップマップがあるかどうか
linearテクスチャがリニアカラー空間を使用しているかどうか

説明

外部で作成されたネイティブのテクスチャオブジェクトから Unity テクスチャを作成します。

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.

CreateExternalTexture に渡されたパラメータは、実際にあるテクスチャと一致していなければならず、下地となるテクスチャは 2D でなければいけません(キューブマップや 3D テクスチャは動作しません)

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.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961