Our skeleton has outfit_torso slot, which has 3 possible attachments: outfit_torso_small, outfit_torso_med, outfit_torso_big.
Most skins have these 3 attachments, but not all.
Because of it, SetAttachment("outfit_torso", "outfit_torso_"+ doll.size) throws an error about not finding attachment for outfit_torso slot when we use a skin without these attachments.
Atm I fixed it by adding optional boolean variable to SetAttachment, when it's false the function doesn't throw an error, ie
if (attachment == null && throw_exception) throw new Exception("Attachment not found: " + attachmentName + ", for slot: " + slotName);
Which make the function work equivalently to SetAttachment("outfit_torso", null) when throw_exception is false.
It works just fine, but I wonder if there is a better way to handle it?