Search Unity

The AssetBundle Manager Tutorial Q&A

Discussion in 'Community Learning & Teaching' started by Adam-Buckner, Sep 11, 2015.

  1. me_atif

    me_atif

    Joined:
    Dec 7, 2016
    Posts:
    2
    i have a problem with asset bundle
    i selected the option of asset bundle on local server from assets menu and after that my asset bundles do not build anymore
    anyone help?
     
  2. hernanb

    hernanb

    Joined:
    Jul 18, 2016
    Posts:
    1
    Hello, I write because since a year i have troubles working with assetbundles
    Currently I'm working with Assetbundlegraph, Assetbundlemanager and assetbundle browser, I also tried working with unitywebrequest but always i have problems to download the scene complete.
    The scene is download from a remote server and weighs with all dependences around 32mb
    In detail the asset that contains the scene along with the lighting weighs 10mb, then I have another asset that contains the prefab (16mb) and two other assets that weigh approximately 4mb each with materials and shaders

    The problem is that when downloading with one method or the other, there are always dependencies that do not load correctly, either the prefab of 16mb or the illumination are not displayed.
    The truth is that I do not know what to do or think where my mistake is becouse the problem change between all the scenes tht i have.

    For example if I create a scene and inserted in it an empty object with the SceneLoader like in demo in the editor it works fine but when downloading it from the remote server it does not unless on IOS.

    I enclose some of the codes used, although in truth I do not believe the problem is here.

    Code (CSharp):
    1. protected IEnumerator DownloadABMScene (string sceneNamePath, bool isAdditive){
    2.      
    3.         var levelName = System.IO.Path.GetFileNameWithoutExtension (sceneNamePath);
    4.         var sceneAssetBundle = Settings.Map.GetAssetBundleName (sceneNamePath);
    5.         Debug.Log ("LevelName " + levelName);
    6.         Debug.Log ("SceneAssetBundle " + sceneAssetBundle);
    7.  
    8.         // This is simply to get the elapsed time for this phase of AssetLoading.
    9.         float startTime = Time.realtimeSinceStartup;
    10.  
    11.         // Load level from assetBundle.
    12.         AssetBundleLoadOperation request = AssetBundleManager.LoadLevelAsync(sceneAssetBundle, levelName, isAdditive);
    13.         if (request == null) {
    14.             if (loadEventHandler != null) {
    15.                 loadEventHandler.SendMessage ("OnSceneLoadError");
    16.             }
    17.             yield break;
    18.         }
    19.  
    20.         yield return StartCoroutine(request);
    21.  
    22.         if (request.IsError()) {
    23.             if (request == null) {
    24.                 if (loadEventHandler != null) {
    25.                     loadEventHandler.SendMessage ("OnSceneLoadError");
    26.                 }
    27.                 yield break;
    28.             }
    29.         }
    30.  
    31.         var loadedScene = UnityEngine.SceneManagement.SceneManager.GetSceneByName (levelName);
    32.         UnityEngine.SceneManagement.SceneManager.SetActiveScene (loadedScene);
    33.         // Calculate and display the elapsed time.
    34.         float elapsedTime = Time.realtimeSinceStartup - startTime;
    35.         Debug.Log("Finished loading scene " + levelName + " in " + elapsedTime + " seconds" );
    36.         RadialProgressBar.SetActive(false);
    37.         currentAmount = 100;
    38.         if (loadEventHandler != null) {
    39.             loadEventHandler.SendMessage ("OnSceneLoaded");
    40.         }
    41.         //GameObject.Destroy (gameObject);
    42.         //DontDestroyOnLoad(gameObject);
    43.         DontDestroyOnLoad (GameObject.Find("PhoneRemoteConfig"));
    44.         DontDestroyOnLoad (GameObject.Find("Canvas"));
    45.     }

     
    Last edited: Dec 21, 2017
  3. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    635
    I always get the following error in 2017.2 and 2017.3 with the latest (downloaded a few weeks ago) Asset Bundle Manager after Bundles are built:

    Code (CSharp):
    1. InvalidOperationException: Operation is not valid due to the current state of the object
    2. System.Collections.Stack.Pop () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:329)
    3. UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:323)
    4. UnityEngine.GUILayout.EndScrollView (Boolean handleScrollWheel) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:455)
    5. UnityEditor.EditorGUILayout.EndScrollView () (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:8075)
    6. UnityEngine.AssetBundles.AssetBundleBuildTab.OnGUI (Rect pos) (at Assets/Plugins/AssetBundleBrowser/UnityEngine.AssetBundles/Editor/AssetBundleBrowser/AssetBundleBuildTab.cs:260)
    7. UnityEngine.AssetBundles.AssetBundleBrowserMain.OnGUI () (at Assets/Plugins/AssetBundleBrowser/UnityEngine.AssetBundles/Editor/AssetBundleBrowser/AssetBundleBrowserMain.cs:113)
    8. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    9. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    10. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    11. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    12. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    13. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    14. UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
    15.  
     
  4. callamfry

    callamfry

    Joined:
    Sep 29, 2016
    Posts:
    4
    I'm also having problems with the latest download of the Asset Bundle Manager using unity 2017.3.0f3.
    i've downloaded the manager from https://bitbucket.org/Unity-Technologies/assetbundledemo/overview
    I can simulate the loading using the pre-made AssetLoader and SceneLoader scenes in the editor... but trying both of those scenes on device doesn't load anything, I've tried doing them with On demand resources loading as on demand is what i'm aiming for with my app. Also tried without on demand. I've unticked simulate and built the asset bundles, I've also tried the local asset bundle server option but that always errors out: SocketException: No such host is known. when calling System.Net.Dns.GetHostByName(). REALLY stuck on this and its essential for me to get resources on demand as i'm trying to make a tvOS version of the app. Are there steps i'm missing? the landing page for downloading the Asset Bundle Manager simply says to enable on demand resources so would this work if i actually deployed to test flight instead of running in xcode?
     
  5. Erethan

    Erethan

    Joined:
    Apr 27, 2015
    Posts:
    14
    The Tank example doesn't work for me. When loading the assets, I get the following errors

    First Error
    Error while downloading Asset Bundle: Failed to decompress data for the AssetBundle 'http://192.168.56.1:7888/Windows/tanks-scene-bundle'.

    Second Error
    tanks-scene-bundle is not a valid asset bundle.
    UnityEngine.Debug:LogError(Object)
    AssetBundles.AssetBundleLoadLevelOperation:IsDone() (at Assets/AssetBundleManager/AssetBundleLoadOperation.cs:104)
    AssetBundles.AssetBundleLoadOperation:MoveNext() (at Assets/AssetBundleManager/AssetBundleLoadOperation.cs:17)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)


    What am I doing wrong?
     
  6. carlosfarinhas

    carlosfarinhas

    Joined:
    Apr 12, 2016
    Posts:
    10
     
  7. carlosfarinhas

    carlosfarinhas

    Joined:
    Apr 12, 2016
    Posts:
    10
    @bloodbc, how did you get the current download progress? Cheers
     
  8. sanketbafna

    sanketbafna

    Joined:
    Nov 29, 2013
    Posts:
    1
    Hey Guys,

    I have been using AssetBundle last year and my code was working successfully & now after a year when i am trying to reuse that code its not working.

    I was using LoadAsset script from AssetBundleSamples. I don't understand what has changed.
    One more thing i used the last project and changed its bundle name and other thing and Complete Asset folder but didnt changed the project for all its settings.

    So should i make a fresh new project and then import all the assets