Nodes have various amount of neighbours (let it be from 2 to 4)
So what I want is to customise each node with amount of its’ neighbours like this:
The properties in Node.ts are like this: @property([cc.Node])
neighbors: cc.Node[] = []; @property([cc.Vec2])
validDirections: cc.Vec2[] = [];
The trouble is each time I bind a neighbours in Cocos Creator, when I select another object it removes all the properties except the length, like this:
So I really don’t get it how to make it static and save the values inside the node
What am I doing wrong?
We have nodes in (x,y) space. Each node has a custom component (Node.ts) on it.
I want to make paths between them, so I define which of them are neighbours.
I set up a property: N size array where each element is cc.Node
Then, in Cocos Creator, I drag each node as an element of N size array.
In Unity, there’s no need in any extra steps, it just remembers which nodes were dragged into array.
In Cocos Creator, however, the only length of array is remembered. Each time I switch between elements in canvas, everything that has been dropped into array erases.
I wonder how can I save these nodes inside of an array.
I guess it requires some extra scripting of me, but I really don’t get it how to handle the nested values (elements of an array).