Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CreateExternalTexture(int, TextureFormat, bool, IntPtr)

Creates a Unity cubemap out of an externally created native cubemap object.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static Cubemap CreateExternalTexture(int width, TextureFormat format, bool mipmap, IntPtr nativeTex)

Parameters

width


Format of underlying cubemap object.

mipmap

Does the cubemap have mipmaps?

nativeTex

Native cubemap texture object.

Returns

Type

Description

Cubemap

Remarks

This function is mostly useful for native code plugins that create platform specific cubemap texture objects outside of Unity, and need to use these cubemaps in Unity Scenes. It is also possible to create a cubemap 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 a Cubemap (2D textures will not work).
For Direct3D-like devices, the
nativeTex
parameter is a pointer to the underlying Direct3D base type, from which a texture can be created. They can be:
D3D11:
ID3D11ShaderResourceView*
or
ID3D11Texture2D*
D3D12:
ID3D12Resource*
For OpenGL/OpenGL ES, the
nativeTex
parameter is a
GLuint
.
For Metal, the
nativeTex
parameter is an
id<MTLTexture>
.
For Vulkan, the
nativeTex
parameter is a
VkImage*
.