How to create an array property with typescript

How can i create an array property of Nods

this is not work for me:
@property({ type: Node })
player: Node[]=[];

[i dont want a dropdown selection, i need a array property with 4 element]

this question is not correct now :

also this is a wrong answer for new cocos creator version:

1 Like

I’ll ask engineering to help. What version are you using?

Tnx, v3.3.1

Try this one:

import { Node } from 'cc'; // Important: We have to import Node from cc module.
    @property([Node])
    arrayOfNodes: Node[] = []

Then in the editor, you will see this one.

You can change the number of arrays by change the value in the textbox. (In my screenshot it’s named: ArrayOfNodes)

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.