Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Public UnityEvent with a 2D array crashes the game when built

Discussion in 'Editor & General Support' started by DreadfulVir, Jan 26, 2023.

  1. DreadfulVir


    Dec 18, 2018
    Hello! I've encountered this very specific and odd bug with Unity. I want to report it but I'm not sure if its fixed or not on later builds. I have a slow internet sadly otherwise I would have tested it myself on the latest build but I have both 2021.1.11f1 & 2021.3.8f1 and this bug seems to happen on both.

    The bug in question is very simple:

    Add this script
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Events;
    4. public class CrashTestScript : MonoBehaviour
    5. {
    6.     public UnityEvent<int[,], Vector2Int> TestEvent;
    7. }
    Then slap it on a gameobject and build the game.

    In the editor nothing happens and everything seems to be working fine however when you build the game and this component gets loaded the game crashes. Also this seems to happen when the variable is public AND with a 2D array.
  2. connermarzen


    Dec 5, 2018
    I also have been experiencing the exact same issue on 2022.2.5f1 and 2021.8.16f1. After about three days straight of debugging a build, I rebuilt scenes AND created an entirely new project. Worst of all, the crash dump and player logs do not present this problem in a discoverable way. The only reason I found the "solution"' to this problem was by chance and hours of trial & error.

    Thank you!