Get properties of prefab node

Hello everyone, i was trying to make List data just like in here. But i dont know how to get all thoose properties. i’ve been searching and try it myself but still i cant get the properties.

Example, i have data like this

ItemList.js

Items[0]
– ID : 0
– Name : Sword

Items[1]
– ID : 1
– Name : Shield

how do i got param ID ? i try using this.node.ID, yes i know its wrong cause i dont know the idea. my prefab root node was a button, so when the button clicked, i need to get the ID.

i was trying to give tag to the prefab too but i got warning tag was removed in Cocos creator 2.4.3. anyone can give me a advice ? Thanks.

Hi, you can use node.getComponent('ItemList').items[0].id

1 Like

Actually when im using touchend listener i cant get the ID. now im using EventTouch and its working. Thanks Before

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