Strange Array Size Issue In Mulridimensional Arrays

I’m using multi-dimensional arrays in unity, but running into some really strange problems with the size of the highest dimensions. Just check this out, maybe you have an idea why it’s happening?

byte[,] neighboursFUCK = new byte[3, 3, 3, 16, 16, 16, 1];
Debug.Log(“neighSizeDEBUG” + neighboursFUCK.GetLength(6));

result:
neighSizeDEBUG3

Pardon the names, I tend to do that when I get frustrated. It seems that whatever I put in the last dimension when declaring the array get s ignored and whatever I put in the first dimension actually becomes the length of the last one. I tried using different data-types, same problem.

Any ideas?

Using your exact code (copied and pasted) prints this for me, which looks correct:

neighSizeDEBUG1

Are you omitting any code or context here?

I guess, but in the script I litteraly have those two lines immediately after one another. I am running this in the ECS environment, but to my knowledge, it should not have an impact on array dimensions.

Thanks a lot for testing it on your end! This means that it must be something withing the midsts of my code which is messing things up for me.

I tested to see if I could make a script which simply creates the array and nothing else whatsoever. I still have the same issue. Here’s the entire code:


using UnityEngine;

public class Spawner : MonoBehaviour
{

void Start()
{
int[,,,,,,] myArray = new int[1, 1, 1, 1, 1, 1, 2];
Debug.Log("myArray Size = " + myArray.GetLength(6));
}
}

myArray Size = 1

Also tested this in a new project without ECS packages, and it works fine in there. All I can say is that it could have something to do with the ECS packages.