Hello All,

I'm trying to make my code a bit more dynamic so I'm trying to get a list of attachments on a slot. Let's say the slot is called Clothes_Torso.'Clothes_Torso')
The code above returns undefined. After reading the docs it says the code should be:
getAttachmentsForSlot (slotIndex: number, attachments: Array<SkinEntry>)
But why would i send along an array of attachments when that's what I want in the first place?

I hope this is somewhat clear?


[EDIT] Oooooooh the attachments: Array<SkinEntry> is an out. The method itself returns nothing. How odd.
  • Postovi: 1


The reason the method takes an array is that it adds the attachments to the provided array. This avoids allocation, which is sometimes important in games (though admittedly this particular method is unlikely to be called very often). Also you can more easily add attachments to an array without needing to copy them from one array to another.

Note you need to pass the slot index, not the name string. The index is on the SlotData, so:
var attachments = [];, attachments);
Or if you only have the name string:
var attachments = [];
var slotIndex ="slot name").index;, attachments);

  • Postovi: 11875

Natrag na Runtimes