Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.3.0b12
2019.1.0a1
2019.1.9f1
2019.2.0a1
2019.3.0a1
Issue ID
1173543
Regression
No
Unity Editor crashes when copy byte array from NativeArray
Steps to reproduce:
1. Download attached project
2. Open "Test" scene
3. Enter play mode
4. Open Profilier
Actual results: Editor crashes
Reproduced with: 2019.3.0a11, 2019.2.1f1, 2019.1.14f1, 2018.4.5f1
Note:
- If Editor doesn't crash reimport scripts and reenter play mode.
- Older Unity version throw compiler errors
========== OUTPUTTING STACK TRACE ==================
0x0000000142B549C7 (Unity) memcpy
0x000000014184C21C (Unity) UnsafeUtility_CUSTOM_MemCpy
0x0000000043289320 (Mono JIT Code) (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility:MemCpy (void*,void*,long)
0x0000000043288B3B (Mono JIT Code) [C:\buildslave\unity\build\Runtime\Export\NativeArray\NativeArray.cs:436] Unity.Collections.NativeArray`1<byte>:Copy (Unity.Collections.NativeArray`1<byte>,int,byte[],int,int)
0x000000004328A203 (Mono JIT Code) [C:\buildslave\unity\build\Runtime\Export\NativeArray\NativeArray.cs:324] Unity.Collections.NativeArray`1<byte>:Copy (Unity.Collections.NativeArray`1<byte>,byte[])
0x0000000043289E93 (Mono JIT Code) [C:\buildslave\unity\build\Runtime\Export\NativeArray\NativeArray.cs:183] Unity.Collections.NativeArray`1<byte>:CopyTo (byte[])
<...>
========== END OF STACKTRACE ===========
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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
Resolution Note:
NativeArray returned by GetData cannot be hold and must be used directly at the frame the function is called. It is using temporary memory that is cleared at next frame. A guard is supposed to throw in editor instead of crashing though (checks are removed in player). I'll check that but it wont fix the issue as this is due to a misuse of the feature.
Note that in 2019.3 there's a new option to provide a NativeArray directly to the readback request that will allo to do what is needed here. It is then the user's responsability to manage the NativeArray life time.