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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- RenderPipelineManager.activeRenderPipelineTypeChanged does not detect changes when changing the Render Pipeline Asset outside of Play Mode
- The Scene View becomes gray and "NullReferenceException" errors are thrown when attaching the Unity Editor process to RenderDoc
- Memory usage rapidly rises when changing colors in the color wheel
- Physically Based Sky's Horizon and Zenith Tint Color Selection Bars don't have immediate access to color pickers
- EmptyAdditionalLightShadowmapTexture leaks from memory when URP quality level is changed using QualitySettings.SetQualityLevel
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.
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.
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.