/// <summary>Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default /// skin}. Attachmentsfrom the new skin are attached if the corresponding attachment from the old skin was attached. If /// there was no old skin, each slot's setup mode attachment is attached from the new skin.</summary> /// <param name="newSkin">May be null.</param> public void SetSkin(Skin newSkin) { if (newSkin != null) { if (skin != null) { newSkin.AttachAll(this, skin); } else { ExposedList <Slot> slots = this.slots; for (int i = 0, n = slots.Count; i < n; i++) { Slot slot = slots.Items[i]; string name = slot.data.attachmentName; if (name != null) { Attachment attachment = newSkin.GetAttachment(i, name); if (attachment != null) { slot.Attachment = attachment; } } } } } skin = newSkin; }