Native arrays cause crashes in standalone builds (2019.2a14)

The following code always causes a crash after the project is built (even though it works inside the editor)

using UnityEngine;
using Unity.Collections;

public class Tests : MonoBehaviour
{
    void Start()
    {
        Debug.Log("1");
        var tileNeighbors = new NativeArray<int>(11, Allocator.Persistent);
        Debug.Log("2");
        tileNeighbors.Dispose();
    }
}

A quick inspection of logs after the crash reveals that it’s caused by allocation of the array.

Wonder if this is related to Instant crash on standalone if Entities package installed (2019.2.0a11-a14) as it’s also crashing on collection alloc. If it’s the same root cause, then you can work around it by doing development builds until Unity gets the fix backported from 2019.3.

Unity should never crash, thus could please submit a bug-report as described in this document:

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.

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.

1 Like

After some further debugging, I believe its the same issue as rizu’s so I’ll skip submiting a duplicate bug report.