- Home /
Message error : BuildPipeline.BuildAssetBundle
Hi Everybody, Does someone know this message ? what causes this?
m_ManagersToReset.empty() UnityEditor.BuildPipeline:BuildAssetBundle(Object, Object[], String, BuildAssetBundleOptions)
I got it on this example project to better understand the assetbundles and the buildpipeline at the following link:
http://unity3d.com/support/resources/example-projects/assetbundles
Could it be explained by the fact that i clicked on "Assets/Auto Build Resource Files" while in runtime ? And so why does runtime generate this error ?
Thank you for any answers.
PS: here is the code:
@MenuItem("Assets/Auto Build Resource Files")
static function ExportResource () {
System.IO.Directory.CreateDirectory("AssetBundles");
var options = BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets;
BuildPipeline.PushAssetDependencies();
// All subsequent resources share assets in this resource file
// It is up to you to ensure that the shared resource file is loaded prior to loading other resources
BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath("Assets/artwork/lerpzuv.tif"), null, "AssetBundles/Shared.unity3d", options);
// By pushing and popping around the resource file, this file will share resources but later resource files will not share assets in this resource
BuildPipeline.PushAssetDependencies();
BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath("Assets/Artwork/Lerpz.fbx"), null, "AssetBundles/Lerpz.unity3d", options);
BuildPipeline.PopAssetDependencies();
// By pushing and popping around the resource file, this file will share resources but later resource files will not share assets in this resource
BuildPipeline.PushAssetDependencies();
BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath("Assets/Artwork/explosive guitex.prefab"), null, "AssetBundles/explosive.unity3d", options);
BuildPipeline.PopAssetDependencies();
// By pushing and popping around the resource file, this file will share resources but later resource files will not share assets in this resource
BuildPipeline.PushAssetDependencies();
// Build streamed scene file into a seperate unity3d file
BuildPipeline.BuildPlayer(["Assets/AdditiveScene.unity"], "AssetBundles/AdditiveScene.unity3d", BuildTarget.WebPlayer, BuildOptions.BuildAdditionalStreamedScenes);
BuildPipeline.PopAssetDependencies();
BuildPipeline.PopAssetDependencies();
BuildPipeline.BuildPlayer(["Assets/Loader.unity"], "loader.unity3d", BuildTarget.WebPlayer, BuildOptions.Development);
}
Answer by AceTrip_RecapIt · Jun 06, 2012 at 04:25 PM
No comments ? OK perharps it was stupid question ... I found by myself anyway. So it seems that using BuildPipeline.BuildAssetBundle while the scene is in playing mode causes this message:
m_ManagersToReset.empty() UnityEditor.BuildPipeline:BuildAssetBundle(Object, Object[], String, BuildAssetBundleOptions)
To avoid that, just create a C# or js script in a folder that you created and named Editor then use the word static for each function and add the MenuItem stuff at the head of your function.
[MenuItem("Assets/nameUpToYou")]
static function ExportResource ()
{
...
}
Now you have just to click on Assets > nameUpToYou and you also call your script in editor mode.
Hoping it will help you.
I need to call that function from InspectorOnGUI thread not from the menu during Play $$anonymous$$ode Is it possible to prevent somehow the error ?
It was not at all a stupid question. I found this by Googling the error and your question+reply helped me understand it's a play-mode thing and I don't need to worry about it. :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613072359im_/https://answers.unity.com/themes/thub/images/avi.jpg)