- Home /
BuildAssetBundles() error: An abnormal situation has occurred: the PlayerLoop internal function has been called recursively.
I'm trying to update my code to use the new method to create AssetBundles. Unfortunately by script I'm not having success.
private IEnumerator BuildAssetBundleNew() {
string[] assetPaths = AssetDatabase.GetAllAssetPaths();
for (int i = 0; i < assetPaths.Length; i++) {
AssetDatabase.Refresh();
yield return new WaitForSeconds(1f);
if ((assetPaths[i].Contains("Materials") == false) &&
(
assetPaths[i].Contains("Assets/Resources/OBJ/")
|| assetPaths[i].Contains("Assets/Resources/Textures/")
|| assetPaths[i].Contains("Assets/Resources/PrefabColliders/")
)
) {
UnityEngine.Object[] assets = AssetDatabase.LoadAllAssetsAtPath(assetPaths[i]);
//------------------------------------------------/*
//BUILD MAP
AssetBundleBuild[] buildMap = new AssetBundleBuild[1];
buildMap[0] = new AssetBundleBuild();
buildMap[0].assetBundleName = assets[0].name + ".unity3d5";
string[] assetsToBuild = new string[1];
assetsToBuild[0] = assetPaths[i];
buildMap[0].assetNames = assetsToBuild;
//------------------------------------------------*/
AddBuildMap(buildMap);
qtAbFiles++;
}
}
yield return StartCoroutine(BuildAllAssetsFromBuildMap());
yield return new WaitForSeconds(1.0f);
EncryptAssetBundles();
}
//----------------------------------------------------------
private AssetBundleBuild[] finalBuildMap;
private void AddBuildMap(AssetBundleBuild[] buildMap) {
AssetBundleBuild[] aux = finalBuildMap;
finalBuildMap = new AssetBundleBuild[qtAbFiles+1];
Debug.Log("qtAbFiles" + qtAbFiles);
if (qtAbFiles == 0) {
finalBuildMap[0] = new AssetBundleBuild();
finalBuildMap[0] = buildMap[0];
} else {
for (int i = 0; i < qtAbFiles; i++) {
finalBuildMap[i] = new AssetBundleBuild();
finalBuildMap[i] = aux[i];
}
finalBuildMap[qtAbFiles] = buildMap[0];
}
}
//----------------------------------------------------------
private IEnumerator BuildAllAssetsFromBuildMap() {
yield return null;
BuildPipeline.BuildAssetBundles("Assets/Resources/AssetBundle/", finalBuildMap);
}
//----------------------------------------------------------
The error occurs in the "BuildPipeline.BuildAssetBundles("Assets/Resources/AssetBundle/", finalBuildMap);" line BUT all AssetBundles are created... The problem is that script stop to work and the next method is not called.
I tried a lot of ways to create an AssetBundle using this new method, but always I'm getting this error:
"An abnormal situation has occurred: the PlayerLoop internal function has been called recursively. Please contact Customer Support with a sample project so that we can reproduce the problem and troubleshoot it. UnityEditor.BuildPipeline:BuildAssetBundles(String, AssetBundleBuild[]) c__Iterator5:MoveNext() (at Assets/Scripts/NMABuilder.cs:352)"
NOTE: In this case was created 4 AssetBundles, so the Iterator5:MoveNext could be some valuable information.
Thanks in advance!
Your answer
Follow this Question
Related Questions
No AssetBundle.mainAsset with BuildingAssetBundles in 5.x ? 2 Answers
Errors When Making a New Unity5 3d Project 1 Answer
Strange Repetitive Error 0 Answers
unity unable to convert to dex format, need help fast. 0 Answers
Does New AssetBundle Build System in Unity 5 require separate packages for separate platforms 1 Answer