private void AddSlotFromCollection(SlotDataAsset slotDataAsset, UMAWardrobeCollection uwc) { if (!SlotTracker.ContainsKey(slotDataAsset.GetInstanceID())) { SlotTracker.Add(slotDataAsset.GetInstanceID(), new List <UMATextRecipe>()); } SlotTracker[slotDataAsset.GetInstanceID()].Add(uwc); }
public static void SaveAsRecipe() { SlotDataAsset sd = null; OverlayDataAsset od = null; foreach (UnityEngine.Object obj in Selection.objects) { // Make sure it's in the project, not the hierarchy. // Not sure how we would ever have Slots and Overlays in the hierarchy though. if (AssetDatabase.Contains(obj)) { if (obj is SlotDataAsset) { sd = obj as SlotDataAsset; } if (obj is OverlayDataAsset) { od = obj as OverlayDataAsset; } } } if (sd == null) { EditorUtility.DisplayDialog("Notice", "A SlotDataAsset must be selected in the project view", "Got it"); return; } string assetPath = AssetDatabase.GetAssetPath(sd.GetInstanceID()); string path = Path.GetDirectoryName(assetPath); string AssetName = Path.GetFileNameWithoutExtension(assetPath); if (AssetName.ToLower().Contains("_slot")) { AssetName = Regex.Replace(AssetName, "_slot", "_Recipe", RegexOptions.IgnoreCase); } else { AssetName += "_Recipe"; } assetPath = Path.Combine(path, AssetName + ".asset"); bool doCreate = false; if (File.Exists(assetPath)) { if (EditorUtility.DisplayDialog("File Already Exists!", "An asset at that location already exists! Overwrite it?", "Yes", "Cancel")) { doCreate = true; } } else { doCreate = true; } if (doCreate) { CreateRecipe(assetPath, sd, od, sd.name, true); Debug.Log("Recipe created at: " + assetPath); } }