name = map.getString("name", name);
String path = map.getString("path", name);
switch (AttachmentType.valueOf(map.getString("type", AttachmentType.region.name()))) {
case region: {
RegionAttachment region = attachmentLoader.newRegionAttachment(skin, name, path);
if (region == null) return null;
region.setPath(path);
region.setX(map.getFloat("x", 0) * scale);
region.setY(map.getFloat("y", 0) * scale);
region.setScaleX(map.getFloat("scaleX", 1));
region.setScaleY(map.getFloat("scaleY", 1));
region.setRotation(map.getFloat("rotation", 0));
region.setWidth(map.getFloat("width") * scale);
region.setHeight(map.getFloat("height") * scale);
String color = map.getString("color", null);
if (color != null) region.getColor().set(Color.valueOf(color));
region.updateOffset();
return region;
}
case boundingbox: {
BoundingBoxAttachment box = attachmentLoader.newBoundingBoxAttachment(skin, name);
if (box == null) return null;