@property({type: [[Prefab]] }) prefab:Prefab[][]=[] --> no error in code, but runtime error in editor

Cocos Creator 3.8.4

@property({type: [[Prefab]] }) prefab:Prefab[][]=[]
→ No error in code, but runtime error in editor:

“Please define ‘type’ parameter of BattleSystem.enemyPrefabsPerRow as the constructor of class Prefab extends Asset”, etc, etc…

@property( [[Prefab]] ) prefab:Prefab[][]=[]
→ Error in VSCode:

no overload matches this call.
Overload 1 of 3, '(options?: _cocos_core_data_utils_attribute_defines__IExposedAttributes)…etc,etc.

Any help here?

Best,
tL.


You can use this way. Please refer to the screenshot

Hmm, I don’t know, these examples on the screenshot don’t include ‘array of prefab arrays’…?

Looks to me like a normal everyday @property({ type: [prefab]}) myPrefab[] = [] (which means, like I understand it, a typical prefab array) not like a type: [[prefab]], which I see as an array of prefab-arrays, no?


there is the way to fulfill the two dimensions of arrays of prefab.

Ah, alright, I missed something in your screenshot.
Yeah, making a class will do it.

Thanks!