private static void TryCreateHairAndBeardAssets() { var folder = "Hair"; string directory = $"/{PARENT_FOLDER}/{folder}/"; if (hairPresets != null && hairPresets.Count > 0) { if (AssetDatabase.IsValidFolder($"Assets{directory}") == false) { AssetDatabase.CreateFolder($"Assets/{PARENT_FOLDER}", folder); } foreach (var item in hairPresets) { var characterItem = new CharacterItem(); characterItem.mesh = item.mesh; characterItem.itemType = ItemType.Hair; AssetDatabase.CreateAsset(characterItem, $"Assets{directory}{item.name}.asset"); } Debug.Log("Created hair assets."); } if (beardPresets != null && beardPresets.Count > 0) { folder = "Beards"; directory = $"/{PARENT_FOLDER}/{folder}/"; if (AssetDatabase.IsValidFolder($"Assets{directory}") == false) { AssetDatabase.CreateFolder($"Assets/{PARENT_FOLDER}", folder); } foreach (var item in beardPresets) { var characterItem = new CharacterItem(); characterItem.mesh = item.mesh; characterItem.itemType = ItemType.Beard; AssetDatabase.CreateAsset(characterItem, $"Assets{directory}{item.name}.asset"); } Debug.Log("Created beard assets."); } }
private static void CreateClothingItems(ClothPreset[] clothPreset, ItemType itemType, string folder) { string directory = $"/{PARENT_FOLDER}/{folder}/"; if (AssetDatabase.IsValidFolder($"Assets{directory}") == false) { AssetDatabase.CreateFolder($"Assets/{PARENT_FOLDER}", folder); } foreach (var item in clothPreset) { var characterItem = new CharacterItem(); characterItem.itemType = itemType; characterItem.mesh = item.mesh; characterItem.hideParts = item.hideParts; characterItem.mats = item.mats; characterItem.yOffset = item.yOffset; AssetDatabase.CreateAsset(characterItem, $"Assets{directory}{item.name}.asset"); } Debug.Log($"Created {itemType.ToString().ToLower()} assets."); }