Search Issue Tracker

Fixed

Fixed in 2021.3.28f1

Votes

29

Found in

2021.3.27f1

Issue ID

UUM-3768

Regression

No

[M1] Editor/Player freezes when calling GetNativeTexturePtr

--

-

Reproduction steps:
1. Open users attached project
2. Open Assets/Test scene
3. Enter the Play Mode

Expected result: Play Mode is running
Actual result: Editor freezes after around 5-10 seconds

Reproducible with: 2021.2.19f1, 2022.1.0b15, 2022.2.0a9
Not reproducible with: 2019.4.37f1, 2020.3.32f1

Notes:
-also reproducible in Player
-sometimes it takes around a minute for Editor to freeze
-not reproducible with Rosseta
-only reproducible with M1

Comments (3)

  1. KyryloKuzyk

    May 11, 2023 07:31

    I somewhat worked around the issue by caching the IntPtr returned from Texture2d.GetNativeTexturePtr().

    Texture2D.LoadImage/LoadRawTextureData() modify the underlying native texture pointer, so I had to create a temporary texture first, then copy it to my desired texture with Graphics.CopyTexture(). Graphics.CopyTexture() preserves the original texture pointer, so it can be cached and reused.

    Of course, this workaround has terrible performance, but in my case, it wasn't critical.

  2. kassskata

    Feb 23, 2023 09:41

    Disscussing that issue in that post.
    https://forum.unity.com/threads/texture-getnativetextureptr-may-not-return-on-m1-mac.1258506/#post-8826076
    Reproduce it inside Unity's Native Rendering sample.

  3. Andy-Block

    Feb 22, 2023 12:22

    I'm seeing the same on 2021.3.19f1 (on an M2) using a 3rd party utility called "Resource checker". It used to work fine on my Intel MacBook, but I just upgraded to the M2, and now it seems to freeze instantly every time I try to use it. Breaking in a debugger shows it is stuck in this method somehow.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.