Not signed in
Copyright © 2026 Unity Technologies
As expained in the docs at https://docs.unity3d.com/6000.1/Documentation/ScriptReference/Texture2D.CreateExternalTexture.html you need to pass a VkImage* (thus a pointer to a VkImage. E.g. changing the script to the following fixes the issue locally for me on vulkan: IntPtr vkImageToRef = nativeTexture.image; IntPtr imageRefStar = new IntPtr(&vkImageToRef); texture = Texture2D.CreateExternalTexture(width, height, TextureFormat.RGBA32, false, true, imageRefStar); This can also be found on the forums: https://discussions.unity.com/t/error-when-importing-textures-using-vulkan-native-rendering-plugin/898563 As for the crash when using other APIs than Vulkan. This is because you are passing in an invalid type. When using DirectX you have to pass in a valid DirectX texture to CreateExternalTexture not a Vulkan image. See the docs referenced above for the correct usage of the CreateExternalTexture function on all graphics APIs.
Reproduction steps:
1. Open the attached “repro_IN-101754“ project
2. Open the “Assets/Scenes/SampleScene.unity“ Scene
3. Enter the Play Mode
4. Observe the crash
Reproducible with: 2023.3.0a15, 6000.0.49f1, 6000.1.4f1, 6000.2.0b2
Not reproducible with: 2022.3.63f1, 2023.2.0a20, 2023.3.0a14
Reproducible on: Windows 10 (22H2)
Not reproducible on: macOS Sequoia 15.3 (M2 Ultra)
Notes:
First few lines of the stack trace when using DirectX11, DirectX12, or OpenGL ES 3.2:
0x00007FFA036A6132 (Unity) vk::InstanceImpl
0x00007FFA582D136A (NativePlugin) UnityPluginLoad
0x00007FFA0339DE34 (Unity) RegisterPlugin
0x00007FFA0339B494 (Unity) FindAndLoadUnityPlugin
0x00007FFA284CECAB (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\native-library.c:1207] legacy_probe_for_module
First few lines of the stack trace when using Vulkan:
0x00007FFA565453A1 (nvoglv64) vkGetInstanceProcAddr
0x00007FFA56544D50 (nvoglv64) vkGetInstanceProcAddr
0x00007FFAB60CDF48 (graphics-hook64) dummy_debug_proc
0x00007FFA3EE1190D (vulkan-1) vkResetEvent
0x00007FFA03A277E5 (Unity) vk::Image::CreateImageViews
Sign in to see your voted issues