Search Unity

Bug An issue for getting texture in native with Vulkan

Discussion in 'General Graphics' started by kyo8568131, May 5, 2023.

  1. kyo8568131

    kyo8568131

    Joined:
    Dec 16, 2014
    Posts:
    2
    Hi, we've encountered an issue while developing rendering plugin with Vulkan.
    We get the texture of material from MeshRenderer, pass the pointer to native and use AccessTexture to get the UnityVulkanImage to do the rest rendering things.
    It works in general cases, but sometimes an access violation exception occurs when using AccessTexture.
    It could be reproduced(but not every time) by the following steps:
    1.Create two GameObject with the native script and the same textures but different materials.
    2.Click play and it could work normally.
    3.Stop and set the texture to none for one of the GameObject.
    4.Click play. The exception occurs and crash the Unity Editor.

    We've check null for getting texture, but the exception occurs on the GameObject with a texture.
    The texture data seems normal and pass all the null check. Finally it crashes in AccessTexture.
    Our Unity version is 2021.3.14. It could be reproduced in 2022.1.22f1.
    Would it be possible to avoid this exception?
    Thank you for any help.