Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Native arrays cause crashes in standalone builds (2019.2a14)

Discussion in '2019.2 Beta' started by Imakhiil, May 4, 2019.

  1. Imakhiil

    Imakhiil

    Joined:
    Oct 11, 2013
    Posts:
    96
    The following code always causes a crash after the project is built (even though it works inside the editor)
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using Unity.Collections;
    4.  
    5. public class Tests : MonoBehaviour
    6. {
    7.     void Start()
    8.     {
    9.         Debug.Log("1");
    10.         var tileNeighbors = new NativeArray<int>(11, Allocator.Persistent);
    11.         Debug.Log("2");
    12.         tileNeighbors.Dispose();
    13.     }
    14. }
    15.  
    A quick inspection of logs after the crash reveals that it's caused by allocation of the array.
     
  2. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,642
    Unity should never crash, thus could please submit a bug-report as described in this document:
    https://unity3d.com/unity/qa/bug-reporting

    It's important that you report these issues together with a reproduction project if you want them to get fixed. If you don't do it, it might be a long time until someone else reports them or until Unity Technologies find them.

    After you submitted the bug-report, you receive a confirmation email with a bug-report Case number. Please post the Case number (number only, not the link) in this forum thread for Unity staff to pick up.
     
  4. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    If it's the same bug, it's already been reported (I provided issue ID on my thread) + Unity is aware of that issue. Support already closed my ticket.
     
    Peter77 likes this.
  5. Imakhiil

    Imakhiil

    Joined:
    Oct 11, 2013
    Posts:
    96
    After some further debugging, I believe its the same issue as rizu's so I'll skip submiting a duplicate bug report.