Hi there
I will create jagged array and initialize the array.
The variables are null but the type are the class which extended MonoBehavior".
like this
{
{null, null, null,...}
{null, null, null,...}
{null, null, null,...}
}
I defined variable.
private Enemy[][] checkEnemyArray;
it is the code i did.
int row = 30;
int column = 40;
checkEnemyArray = Enumerable.Range(0, row).Select(
x => Enumerable.Range(0, column).Select(y => new Enemy()).ToArray<Enemy>()
).ToArray<Enemy[]>();
It works little nice but the warning occurred.
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent().
but, I tried like this, I put null instead Enemy() but error occurred
checkEnemyArray = Enumerable.Range(0, row).Select(
x => Enumerable.Range(0, column).Select(y => null).ToArray<Enemy>()
).ToArray<Enemy[]>();
Could you tell me the good way?