//int recipePickerID = -1; This is needed if we can make the recipe drop area work with 'Click To Pick'

            public WardrobeCollectionMasterEditor(UMAData.UMARecipe recipe, List <string> compatibleRaces, WardrobeCollectionList wardrobeCollection, List <string> arbitraryRecipes) : base(recipe)
            {
                _compatibleRaces    = compatibleRaces;
                _wardrobeCollection = wardrobeCollection;
                _arbitraryRecipes   = arbitraryRecipes;
                UpdateFoldouts();
                recipesAddErrMsg = "";
            }
            private void UpdateBackwardsCompatibleData()
            {
                var context = UMAContext.FindInstance();

                if (context == null)
                {
                    var _errorMessage = "Editing a recipe requires a loaded scene with a valid UMAContext.";
                    Debug.LogWarning(_errorMessage);
                }
                //reset the recipe to the raceBase recipe
                var thisBaseRecipe = _recipe.raceData.baseRaceRecipe;

                thisBaseRecipe.Load(_recipe, context);
                if (_wardrobeSet.Count > 0)
                {
                    var thisDCS = context.dynamicCharacterSystem;
                    if (thisDCS == null)
                    {
                        var _errorMessage = "Editing a recipe requires a loaded scene with a valid UMAContext.";
                        Debug.LogWarning(_errorMessage);
                    }
                    List <UMARecipeBase> Recipes = new List <UMARecipeBase>();
                    List <string>        SuppressSlotsStrings = new List <string>();
                    List <string>        HiddenSlots          = new List <string>();
                    var wardrobeRecipesToRender = new Dictionary <string, UMARecipeBase>();
                    var activeRace = _recipe.raceData.raceName;
                    //Dont add the WardrobeCollection to the recipes to render- they doesn't render directly and will have already set their actual wardrobeRecipe slots SetSlot
                    foreach (WardrobeSettings set in _wardrobeSet)
                    {
                        var thisRecipe = thisDCS.GetBaseRecipe(set.recipe);
                        if (thisRecipe == null)
                        {
                            continue;
                        }
                        if (thisRecipe.GetType().ToString() == "UMA.UMAWardrobeCollection")
                        {
                            var       TargetType = thisRecipe.GetType();
                            FieldInfo WardrobeCollectionField         = TargetType.GetField("wardrobeCollection", BindingFlags.Public | BindingFlags.Instance);
                            WardrobeCollectionList wardrobeCollection = (WardrobeCollectionList)WardrobeCollectionField.GetValue(thisRecipe);
                            if (wardrobeCollection[activeRace] != null)
                            {
                                foreach (WardrobeSettings ws in wardrobeCollection[activeRace])
                                {
                                    var wsRecipe = thisDCS.GetBaseRecipe(ws.recipe);
                                    if (wsRecipe != null)
                                    {
                                        if (wardrobeRecipesToRender.ContainsKey(ws.slot))
                                        {
                                            wardrobeRecipesToRender[ws.slot] = wsRecipe;
                                        }
                                        else
                                        {
                                            wardrobeRecipesToRender.Add(ws.slot, wsRecipe);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            //_recipe.Merge(thisRecipe.GetCachedRecipe(context), true);
                            if (wardrobeRecipesToRender.ContainsKey(set.slot))
                            {
                                wardrobeRecipesToRender[set.slot] = thisRecipe;
                            }
                            else
                            {
                                wardrobeRecipesToRender.Add(set.slot, thisRecipe);
                            }
                        }
                    }
                    if (wardrobeRecipesToRender.Count > 0)
                    {
                        foreach (UMARecipeBase utr in wardrobeRecipesToRender.Values)
                        {
                            var       TargetType                = utr.GetType();
                            FieldInfo CompatibleRacesField      = TargetType.GetField("compatibleRaces", BindingFlags.Public | BindingFlags.Instance);
                            FieldInfo WardrobeSlotField         = TargetType.GetField("wardrobeSlot", BindingFlags.Public | BindingFlags.Instance);
                            FieldInfo SuppressWardrobeSlotField = TargetType.GetField("suppressWardrobeSlots", BindingFlags.Public | BindingFlags.Instance);

                            //field values
                            List <string> compatibleRaces      = (List <string>)CompatibleRacesField.GetValue(utr);
                            string        wardrobeSlot         = (string)WardrobeSlotField.GetValue(utr);
                            List <string> suppressWardrobeSlot = (List <string>)SuppressWardrobeSlotField.GetValue(utr);

                            if (suppressWardrobeSlot != null)
                            {
                                if (activeRace == "" || ((compatibleRaces.Count == 0 || compatibleRaces.Contains(activeRace)) || (_recipe.raceData.IsCrossCompatibleWith(compatibleRaces) && _recipe.raceData.wardrobeSlots.Contains(wardrobeSlot))))
                                {
                                    if (!SuppressSlotsStrings.Contains(wardrobeSlot))
                                    {
                                        foreach (string suppressedSlot in suppressWardrobeSlot)
                                        {
                                            SuppressSlotsStrings.Add(suppressedSlot);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    foreach (string ws in _recipe.raceData.wardrobeSlots)
                    {
                        if (SuppressSlotsStrings.Contains(ws))
                        {
                            continue;
                        }
                        if (wardrobeRecipesToRender.ContainsKey(ws))
                        {
                            UMARecipeBase utr                  = wardrobeRecipesToRender[ws];
                            var           TargetType           = wardrobeRecipesToRender[ws].GetType();
                            FieldInfo     CompatibleRacesField = TargetType.GetField("compatibleRaces", BindingFlags.Public | BindingFlags.Instance);
                            FieldInfo     WardrobeSlotField    = TargetType.GetField("wardrobeSlot", BindingFlags.Public | BindingFlags.Instance);
                            FieldInfo     HidesField           = TargetType.GetField("Hides", BindingFlags.Public | BindingFlags.Instance);

                            //field values
                            List <string> compatibleRaces = (List <string>)CompatibleRacesField.GetValue(utr);
                            string        wardrobeSlot    = (string)WardrobeSlotField.GetValue(utr);
                            List <string> hides           = (List <string>)HidesField.GetValue(utr);

                            if (activeRace == "" || ((compatibleRaces.Count == 0 || compatibleRaces.Contains(activeRace)) || (_recipe.raceData.IsCrossCompatibleWith(compatibleRaces) && _recipe.raceData.wardrobeSlots.Contains(wardrobeSlot))))
                            {
                                Recipes.Add(utr);
                                if (hides.Count > 0)
                                {
                                    foreach (string s in hides)
                                    {
                                        HiddenSlots.Add(s);
                                    }
                                }
                            }
                        }
                    }
                    //merge them in
                    foreach (var additionalRecipe in Recipes)
                    {
                        _recipe.Merge(additionalRecipe.GetCachedRecipe(context), true);
                    }
                    if (HiddenSlots.Count > 0)
                    {
                        List <SlotData> NewSlots = new List <SlotData>();
                        foreach (SlotData sd in _recipe.slotDataList)
                        {
                            if (sd == null)
                            {
                                continue;
                            }
                            if (!HiddenSlots.Contains(sd.asset.slotName))
                            {
                                NewSlots.Add(sd);
                            }
                        }
                        _recipe.slotDataList = NewSlots.ToArray();
                    }
                    ResetSlotEditors();
                }
            }