public void OnEnable() { slot = target as SlotDataAsset; #pragma warning disable 618 if (slot.meshData != null) { //if (slot.meshData.rootBoneHash != null) //{ // umaBoneData = GetTransformsInPrefab(slot.meshData.rootBone); //} //else //{ umaBoneData = new Transform[0]; //} } #if !UMA2_LEAN_AND_CLEAN else if (slot.meshRenderer != null) { umaBoneData = GetTransformsInPrefab(slot.meshRenderer.rootBone); } #endif else { umaBoneData = new Transform[0]; } #pragma warning restore 618 }
public override void AddSlotAsset(SlotDataAsset slot) { ValidateDictionary(); if (slotDictionary.ContainsKey(slot.nameHash)) { for (int i = 0; i < slotElementList.Length; i++) { if (slotElementList[i].slotName == slot.slotName) { slotElementList[i] = slot; break; } } } else { var list = new SlotDataAsset[slotElementList.Length + 1]; for (int i = 0; i < slotElementList.Length; i++) { list[i] = slotElementList[i]; } list[list.Length - 1] = slot; slotElementList = list; } slotDictionary[slot.nameHash] = slot; }
/// <summary> /// Instantiate a slot by name. /// </summary> /// <returns>The slot.</returns> /// <param name="name">Name.</param> public override SlotData InstantiateSlot(string name) { #if SUPER_LOGGING Debug.Log("Instantiating slot: " + name); #endif SlotDataAsset source = UMAAssetIndexer.Instance.GetAsset <SlotDataAsset>(name); if (source == null) { throw new UMAResourceNotFoundException("UMAGlobalContext: Unable to find SlotDataAsset: " + name); } return(new SlotData(source)); }
/// <summary> /// Constructor for slot using the given asset. /// </summary> /// <param name="asset">Asset.</param> public SlotData(SlotDataAsset asset) { this.asset = asset; if (asset) { overlayScale = asset.overlayScale; rendererAsset = asset.RendererAsset; } else { overlayScale = 1.0f; } }
public void Assign(SlotDataAsset source) { slotName = source.slotName; nameHash = source.nameHash; material = source.material; overlayScale = source.overlayScale; animatedBoneNames = source.animatedBoneNames; animatedBoneHashes = source.animatedBoneHashes; meshData = source.meshData; subMeshIndex = source.subMeshIndex; slotGroup = source.slotGroup; tags = source.tags; }
private SlotDataAsset[] GetSlotDataAssetArray() { int arrayCount = m_SlotDataAssetCount.intValue; SlotDataAsset[] SlotDataAssetArray = new SlotDataAsset[arrayCount]; for (int i = 0; i < arrayCount; i++) { SlotDataAssetArray[i] = m_Object.FindProperty(string.Format(kArrayData, i)).objectReferenceValue as SlotDataAsset; } return SlotDataAssetArray; }
private void CreatePoseSet(string fileName) { SlotDataAsset sda = CustomAssetUtility.CreateAsset <SlotDataAsset>("", false, fileName + "_Slot", false); sda.slotName = sda.name; sda.nameHash = UMAUtils.StringToHash(sda.slotName); DynamicDNAConverterController ddcc = UMA.CustomAssetUtility.CreateAsset <DynamicDNAConverterController>("", false, fileName + "_Controller", false); sda.slotDNA = ddcc; DynamicUMADnaAsset duda = UMA.CustomAssetUtility.CreateAsset <DynamicUMADnaAsset>("", false, fileName + "_DNAAsset", false); ddcc.DNAAsset = duda; UMABonePose bp = UMA.CustomAssetUtility.CreateAsset <UMABonePose>("", true, fileName + "_Pose", false); BonePoseDNAConverterPlugin bpdcp = (BonePoseDNAConverterPlugin)ddcc.AddPlugin(typeof(BonePoseDNAConverterPlugin)); bpdcp.poseDNAConverters.Add(new BonePoseDNAConverterPlugin.BonePoseDNAConverter()); bpdcp.poseDNAConverters[0].poseToApply = bp; bpdcp.poseDNAConverters[0].startingPoseWeight = 1.0f; EditorUtility.SetDirty(sda); EditorUtility.SetDirty(ddcc); EditorUtility.SetDirty(duda); EditorUtility.SetDirty(bp); EditorUtility.SetDirty(bpdcp); if (addToLibrary) { UMAAssetIndexer.Instance.EvilAddAsset(typeof(SlotDataAsset), sda); UMAAssetIndexer.Instance.EvilAddAsset(typeof(DynamicUMADnaAsset), duda); EditorUtility.SetDirty(UMAAssetIndexer.Instance); } if (createWardrobeRecipe) { string path = CustomAssetUtility.GetAssetPathAndName <UMAWardrobeRecipe>(fileName, false); UMAWardrobeRecipe uwr = UMAEditorUtilities.CreateRecipe(path, sda, null, fileName, addToLibrary); uwr.compatibleRaces = new List <string>(); uwr.wardrobeSlot = "Physique"; uwr.compatibleRaces.Add(raceNames[selectedRace]); EditorUtility.SetDirty(uwr); } AssetDatabase.SaveAssets(); }
/// <summary> /// Constructor for slot using the given asset. /// </summary> /// <param name="asset">Asset.</param> public SlotData(SlotDataAsset asset) { this.asset = asset; if (asset) { tags = asset.tags; Races = asset.Races; overlayScale = asset.overlayScale; rendererAsset = asset.RendererAsset; } else { tags = new string[0]; overlayScale = 1.0f; } if (Races == null) { Races = new string[0]; } }
public void Initialize() { SlotDataAsset slot = asset; if (slot == null) { _triangleFlags = null; return; } if (slot.meshData == null) { return; } _triangleFlags = new BitArray[slot.meshData.subMeshCount]; for (int i = 0; i < slot.meshData.subMeshCount; i++) { _triangleFlags[i] = new BitArray(slot.meshData.submeshes[i].triangles.Length / 3); } }
public static string GetEvilName(Object o) { if (!o) { return("<Not Found!>"); } if (o is SlotDataAsset) { SlotDataAsset sd = o as SlotDataAsset; return(sd.slotName); } if (o is OverlayDataAsset) { OverlayDataAsset od = o as OverlayDataAsset; return(od.overlayName); } if (o is RaceData) { return((o as RaceData).raceName); } return(o.name); }
/// <summary> /// Constructor for slot using the given asset. /// </summary> /// <param name="asset">Asset.</param> public SlotData(SlotDataAsset asset) { this.asset = asset; overlayScale = asset.overlayScale; rendererAsset = asset.RendererAsset; }
/// <summary> /// Add a slot asset to the context. /// </summary> /// <param name="slot">New slot asset.</param> public void AddSlotAsset(SlotDataAsset slot) { slotLibrary.AddSlotAsset(slot); }
/// <summary> /// Constructor for slot using the given asset. /// </summary> /// <param name="asset">Asset.</param> public SlotData(SlotDataAsset asset) { this.asset = asset; overlayScale = asset.overlayScale; }
/// <summary> /// Removes a list of downloadingAssetItems from the downloadingItems List. /// </summary> /// <param name="assetName"></param> public IEnumerator RemoveDownload(List <DownloadingAssetItem> itemsToRemove) { //Not used any more UMAs check the status of stuff they asked for themselves //Dictionary<UMAAvatarBase, List<string>> updatedUMAs = new Dictionary<UMAAvatarBase, List<string>>(); foreach (DownloadingAssetItem item in itemsToRemove) { item.isBeingRemoved = true; } foreach (DownloadingAssetItem item in itemsToRemove) { string error = ""; //we need to check everyitem in this batch belongs to an asset bundle that has actually been loaded LoadedAssetBundle loadedBundleTest = AssetBundleManager.GetLoadedAssetBundle(item.containingBundle, out error); AssetBundle loadedBundleABTest = loadedBundleTest.m_AssetBundle; if (loadedBundleABTest == null && (String.IsNullOrEmpty(error))) { while (loadedBundleTest.m_AssetBundle == null) { //could say we are unpacking here yield return(null); } } if (!String.IsNullOrEmpty(error)) { Debug.LogError(error); yield break; } } //Now every item in the batch should be in a loaded bundle that is ready to use. foreach (DownloadingAssetItem item in itemsToRemove) { if (item != null) { string error = ""; var loadedBundle = AssetBundleManager.GetLoadedAssetBundle(item.containingBundle, out error); var loadedBundleAB = loadedBundle.m_AssetBundle; if (!String.IsNullOrEmpty(error)) { Debug.LogError(error); yield break; } var itemFilename = AssetBundleManager.AssetBundleIndexObject.GetFilenameFromAssetName(item.containingBundle, item.requiredAssetName, item.tempAsset.GetType().ToString()); if (item.tempAsset.GetType() == typeof(RaceData)) { RaceData actualRace = loadedBundleAB.LoadAsset <RaceData>(itemFilename); UMAContext.Instance.raceLibrary.AddRace(actualRace); UMAContext.Instance.raceLibrary.UpdateDictionary(); } else if (item.tempAsset.GetType() == typeof(SlotDataAsset)) { SlotDataAsset thisSlot = null; thisSlot = loadedBundleAB.LoadAsset <SlotDataAsset>(itemFilename); if (thisSlot != null) { UMAContext.Instance.slotLibrary.AddSlotAsset(thisSlot); } else { Debug.LogWarning("[DynamicAssetLoader] could not add downloaded slot" + item.requiredAssetName); } } else if (item.tempAsset.GetType() == typeof(OverlayDataAsset)) { OverlayDataAsset thisOverlay = null; thisOverlay = loadedBundleAB.LoadAsset <OverlayDataAsset>(itemFilename); if (thisOverlay != null) { UMAContext.Instance.overlayLibrary.AddOverlayAsset(thisOverlay); } else { Debug.LogWarning("[DynamicAssetLoader] could not add downloaded overlay" + item.requiredAssetName + " from assetbundle " + item.containingBundle); } } else if (item.tempAsset.GetType() == typeof(UMATextRecipe)) { UMATextRecipe downloadedRecipe = loadedBundleAB.LoadAsset <UMATextRecipe>(itemFilename); (UMAContext.Instance.dynamicCharacterSystem as UMACharacterSystem.DynamicCharacterSystem).AddRecipe(downloadedRecipe); } else if (item.tempAsset.GetType() == typeof(UMAWardrobeRecipe)) { UMAWardrobeRecipe downloadedRecipe = loadedBundleAB.LoadAsset <UMAWardrobeRecipe>(itemFilename); (UMAContext.Instance.dynamicCharacterSystem as UMACharacterSystem.DynamicCharacterSystem).AddRecipe(downloadedRecipe); } else if (item.dynamicCallback.Count > 0) { //get the asset as whatever the type of the tempAsset is //send this as an array to the dynamicCallback var downloadedAsset = loadedBundleAB.LoadAsset(itemFilename, item.tempAsset.GetType()); var downloadedAssetArray = Array.CreateInstance(item.tempAsset.GetType(), 1); downloadedAssetArray.SetValue(downloadedAsset, 0); for (int i = 0; i < item.dynamicCallback.Count; i++) { item.dynamicCallback[i].DynamicInvoke(downloadedAssetArray); } } if (!String.IsNullOrEmpty(error)) { Debug.LogError(error); } } downloadingItems.Remove(item); } if (downloadingItems.Count == 0) { areDownloadedItemsReady = true; //AssetBundleManager.UnloadAllAssetBundles();//we cant do this yet } //yield break; }
public void Complete() { bool stripUmaMaterials = UMAEditorUtilities.StripUMAMaterials(); try { LogText(""); LogText("****************************************************"); LogText("Generating from recipes: " + DateTime.Now.ToString()); LogText("****************************************************"); LogText(""); bool IncludeRecipes = UMAEditorUtilities.GetConfigValue(UMAEditorUtilities.ConfigToggle_IncludeRecipes, false); bool IncludeOthers = UMAEditorUtilities.GetConfigValue(UMAEditorUtilities.ConfigToggle_IncludeOther, false); string DefaultAddressableLabel = UMAEditorUtilities.GetDefaultAddressableLabel(); RecipeExtraLabels = new Dictionary <string, List <string> >(); var WardrobeCollections = UMAAssetIndexer.Instance.GetAllAssets <UMAWardrobeCollection>(); foreach (var wc in WardrobeCollections) { if (wc == null) { continue; } string label = wc.AssignedLabel; List <string> recipes = wc.wardrobeCollection.GetAllRecipeNamesInCollection(); foreach (string recipe in recipes) { if (RecipeExtraLabels.ContainsKey(recipe) == false) { RecipeExtraLabels.Add(recipe, new List <string>()); } RecipeExtraLabels[recipe].Add(label); } } float pos = 0.0f; float inc = 1.0f / Recipes.Count; foreach (UMAPackedRecipeBase uwr in Recipes) { List <string> ExtraLabels = new List <string>(); if (RecipeExtraLabels.ContainsKey(uwr.name)) { ExtraLabels = RecipeExtraLabels[uwr.name]; } LogText(""); LogText("Processing recipe: " + uwr.name + " Label: " + uwr.AssignedLabel); EditorUtility.DisplayProgressBar("Generating", "processing recipe: " + uwr.name, pos); List <AssetItem> items = Index.GetAssetItems(uwr, true); foreach (AssetItem ai in items) { if (AddressableItems.ContainsKey(ai) == false) { AddressableItems.Add(ai, new List <string>()); AddressableItems[ai].Add(DefaultAddressableLabel); } AddressableItems[ai].Add(uwr.AssignedLabel); AddressableItems[ai].AddRange(ExtraLabels); } if (IncludeRecipes) { AssetItem RecipeItem = UMAAssetIndexer.Instance.GetRecipeItem(uwr); if (AddressableItems.ContainsKey(RecipeItem) == false) { AddressableItems.Add(RecipeItem, new List <string>()); AddressableItems[RecipeItem].Add(DefaultAddressableLabel); } AddressableItems[RecipeItem].Add(uwr.AssignedLabel); AddressableItems[RecipeItem].Add("UMA_Recipes"); AddressableItems[RecipeItem].AddRange(ExtraLabels); } pos += inc; } if (IncludeOthers) { AddAssetItems(typeof(RaceData), DefaultAddressableLabel); AddAssetItems(typeof(RuntimeAnimatorController), DefaultAddressableLabel); AddAssetItems(typeof(TextAsset), DefaultAddressableLabel); AddAssetItems(typeof(DynamicUMADnaAsset), DefaultAddressableLabel); } // Create the shared group that has each item packed separately. AddressableAssetGroup sharedGroup = AddressableUtility.AddressableSettings.FindGroup(SharedGroupName); if (sharedGroup == null) { sharedGroup = AddressableUtility.AddressableSettings.CreateGroup(SharedGroupName, false, false, true, AddressableUtility.AddressableSettings.DefaultGroup.Schemas); sharedGroup.GetSchema <BundledAssetGroupSchema>().BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackSeparately; } pos = 0.0f; inc = 1.0f / AddressableItems.Count; StringBuilder sb = new StringBuilder(); foreach (AssetItem ai in AddressableItems.Keys) { if (!ai.Item) { Debug.LogError($"Asset \"{ai._Name}\" of type \"{ai._Type}\" doesn't exist anymore - did it get deleted?"); continue; } ai.IsAddressable = true; ai.AddressableAddress = ""; // let the system assign it if we are generating. ai.AddressableGroup = sharedGroup.name; EditorUtility.DisplayProgressBar("Generating", "Processing Asset: " + ai.Item.name, pos); sb.Clear(); foreach (string s in AddressableItems[ai]) { sb.Append(s); sb.Append(';'); } ai.AddressableLabels = sb.ToString(); bool found = AssetDatabase.TryGetGUIDAndLocalFileIdentifier(ai.Item.GetInstanceID(), out string itemGUID, out long localID); UMAAddressablesSupport.Instance.AddItemToSharedGroup(itemGUID, ai.AddressableAddress, AddressableItems[ai], sharedGroup); if (ai._Type == typeof(SlotDataAsset) && stripUmaMaterials) { SlotDataAsset sda = ai.Item as SlotDataAsset; if (sda == null) { Debug.Log("Invalid Slotdata in recipe: " + ai._Name + ". Skipping."); continue; } if (sda.material != null) { if (ClearMaterials) { sda.materialName = sda.material.name; sda.material = null; EditorUtility.SetDirty(sda); } else { if (sda.material == null) { sda.material = Index.GetAsset <UMAMaterial>(sda.materialName); EditorUtility.SetDirty(sda); } } } } if (ai._Type == typeof(OverlayDataAsset)) { OverlayDataAsset od = ai.Item as OverlayDataAsset; if (od == null) { Debug.Log("Invalid overlay in recipe: " + ai._Name + ". Skipping."); continue; } if (od.material != null) { if (ClearMaterials) { od.materialName = od.material.name; od.material = null; EditorUtility.SetDirty(od); } else { if (od.material == null) { od.material = Index.GetAsset <UMAMaterial>(od.materialName); EditorUtility.SetDirty(od); } } } #if INCL_TEXTURE2D foreach (Texture tex in od.textureList) { if (tex == null) { continue; } if (tex as Texture2D == null) { Debug.Log("Texture is not Texture2D!!! " + tex.name); continue; } string path = AssetDatabase.GetAssetPath(tex.GetInstanceID()); string Address = "Texture2D-" + tex.name + "-" + path.GetHashCode(); found = AssetDatabase.TryGetGUIDAndLocalFileIdentifier(tex.GetInstanceID(), out string texGUID, out long texlocalID); if (found) { UMAAddressablesSupport.Instance.AddItemToSharedGroup(texGUID, AssetItem.AddressableFolder + Address, AddressableItems[ai], sharedGroup); } } #endif } pos += inc; } UMAAddressablesSupport.Instance.AssignAddressableInformation(); Type[] types = Index.GetTypes(); foreach (Type t in types) { UMAAddressablesSupport.Instance.ReleaseReferences(t); } UMAAddressablesSupport.Instance.CleanupAddressables(true); } finally { EditorUtility.ClearProgressBar(); UMAAssetIndexer.Instance.ForceSave(); } }
public virtual void AddSlotAsset(SlotDataAsset slot) { throw new NotFiniteNumberException(); }
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); } }
private void SetSlotDataAsset(int index, SlotDataAsset slotElement) { m_Object.FindProperty(string.Format(kArrayData, index)).objectReferenceValue = slotElement; isDirty = true; }
private void AddSlotDataAsset(SlotDataAsset slotElement) { m_SlotDataAssetCount.intValue++; SetSlotDataAsset(m_SlotDataAssetCount.intValue - 1, slotElement); }
private void RemoveInvalidSlotDataAsset(SlotDataAsset[] slotElementList) { for (int i = m_SlotDataAssetCount.intValue - 1; i >= 0; i--) { if (slotElementList[i] == null) { RemoveSlotDataAssetAtIndex(i); } } }
/// <summary> /// Add a slot asset to the context. /// </summary> /// <param name="slot">New slot asset.</param> public abstract void AddSlotAsset(SlotDataAsset slot);
/// <summary> /// Add a slot asset to the context. /// </summary> /// <param name="slot">New slot asset.</param> public override void AddSlotAsset(SlotDataAsset slot) { UMAAssetIndexer.Instance.AddAsset(typeof(SlotDataAsset), slot.slotName, "", slot); }
/// <summary> /// Removes a list of downloadingAssetItems from the downloadingItems List. /// </summary> /// <param name="assetName"></param> public IEnumerator RemoveDownload(List <DownloadingAssetItem> itemsToRemove) { //Not used any more UMAs check the status of stuff they asked for themselves //Dictionary<UMAAvatarBase, List<string>> updatedUMAs = new Dictionary<UMAAvatarBase, List<string>>(); foreach (DownloadingAssetItem item in itemsToRemove) { item.isBeingRemoved = true; } foreach (DownloadingAssetItem item in itemsToRemove) { string error = ""; //we need to check everyitem in this batch belongs to an asset bundle that has actually been loaded LoadedAssetBundle loadedBundleTest = AssetBundleManager.GetLoadedAssetBundle(item.containingBundle, out error); AssetBundle loadedBundleABTest = loadedBundleTest.m_AssetBundle; if (loadedBundleABTest == null && (String.IsNullOrEmpty(error))) { while (loadedBundleTest.m_AssetBundle == null) { //could say we are unpacking here yield return(null); } } if (!String.IsNullOrEmpty(error)) { Debug.LogError(error); yield break; } } //Now every item in the batch should be in a loaded bundle that is ready to use. foreach (DownloadingAssetItem item in itemsToRemove) { if (item != null) { string error = ""; var loadedBundle = AssetBundleManager.GetLoadedAssetBundle(item.containingBundle, out error); var loadedBundleAB = loadedBundle.m_AssetBundle; if (!String.IsNullOrEmpty(error)) { Debug.LogError(error); yield break; } var assetType = item.tempAsset.GetType(); //deal with RuntimeAnimatorController funkiness //the actual type of an instantiated clone of a RuntimeAnimatorController in the editor is UnityEditor.Animations.AnimatorController if (assetType.ToString().IndexOf("AnimatorController") > -1) { assetType = typeof(RuntimeAnimatorController); } var itemFilename = AssetBundleManager.AssetBundleIndexObject.GetFilenameFromAssetName(item.containingBundle, item.requiredAssetName, assetType.ToString()); if (assetType == typeof(RaceData)) { //HACK TO FIX RACEDATA DYNAMICDNACONVERTERS DYNAMICDNA ASSETS CAUSING LOAD FAILURES in UNITY 5.5+ //As of Unity 5.5 a bug has reappeared when loading some types of assets that reference assets in other bundles. //AssetBundleManager successfully ensures these required bundles are loaded first, but even so Unity fils to load //the required asset from them in some cases, notably it seems when the required asset is set in the field of a Prefab (like our DNAAssets are) //To fix this generally we could 'LoadAllAssets' from any dependent bundles, but this could incur significant memory overhead //So for now we will just fix this for UMA and hope a patch is forthcoming in a subsequent version of Unity if (AssetBundleManager.AssetBundleIndexObject.GetAllDependencies(item.containingBundle).Length > 0) { var allDeps = AssetBundleManager.AssetBundleIndexObject.GetAllDependencies(item.containingBundle); for (int i = 0; i < allDeps.Length; i++) { string depsError = ""; LoadedAssetBundle depsBundle = AssetBundleManager.GetLoadedAssetBundle(allDeps[i], out depsError); if (String.IsNullOrEmpty(depsError) && depsBundle != null) { depsBundle.m_AssetBundle.LoadAllAssets <DynamicUMADnaAsset>(); } } } RaceData actualRace = loadedBundleAB.LoadAsset <RaceData>(itemFilename); UMAContext.Instance.raceLibrary.AddRace(actualRace); UMAContext.Instance.raceLibrary.UpdateDictionary(); } else if (assetType == typeof(SlotDataAsset)) { SlotDataAsset thisSlot = null; thisSlot = loadedBundleAB.LoadAsset <SlotDataAsset>(itemFilename); if (thisSlot != null) { UMAContext.Instance.slotLibrary.AddSlotAsset(thisSlot); } else { Debug.LogWarning("[DynamicAssetLoader] could not add downloaded slot" + item.requiredAssetName); } } else if (assetType == typeof(OverlayDataAsset)) { OverlayDataAsset thisOverlay = null; thisOverlay = loadedBundleAB.LoadAsset <OverlayDataAsset>(itemFilename); if (thisOverlay != null) { UMAContext.Instance.overlayLibrary.AddOverlayAsset(thisOverlay); } else { Debug.LogWarning("[DynamicAssetLoader] could not add downloaded overlay" + item.requiredAssetName + " from assetbundle " + item.containingBundle); } } else if (assetType == typeof(UMATextRecipe)) { UMATextRecipe downloadedRecipe = loadedBundleAB.LoadAsset <UMATextRecipe>(itemFilename); (UMAContext.Instance.dynamicCharacterSystem as UMACharacterSystem.DynamicCharacterSystem).AddRecipe(downloadedRecipe); } else if (assetType == typeof(UMAWardrobeRecipe)) { UMAWardrobeRecipe downloadedRecipe = loadedBundleAB.LoadAsset <UMAWardrobeRecipe>(itemFilename); (UMAContext.Instance.dynamicCharacterSystem as UMACharacterSystem.DynamicCharacterSystem).AddRecipe(downloadedRecipe); } else if (item.dynamicCallback.Count > 0) { //get the asset as whatever the type of the tempAsset is //send this as an array to the dynamicCallback var downloadedAsset = loadedBundleAB.LoadAsset(itemFilename, assetType); var downloadedAssetArray = Array.CreateInstance(assetType, 1); downloadedAssetArray.SetValue(downloadedAsset, 0); for (int i = 0; i < item.dynamicCallback.Count; i++) { item.dynamicCallback[i].DynamicInvoke(downloadedAssetArray); } } if (!String.IsNullOrEmpty(error)) { Debug.LogError(error); } } downloadingItems.Remove(item); } if (downloadingItems.Count == 0) { areDownloadedItemsReady = true; //AssetBundleManager.UnloadAllAssetBundles();//we cant do this yet } //yield break; }