Forum rules - please read before posting.

Puzzled with AssetBundles

Hi,
I created AssetBundles which include audio clips and lipsync data files (from RogoDigital).
However, despite putting the AssetBundle in the 'StreamingAssets' folder and despite specifying the asset bundle in the AC speech settings, I am getting errors that audio clips and lipsync data are missing from the Resources folder.
I was under the impression that AssetBundles replace Resource folder.
Do I need to setup anything else to use AssetBundles in place of Resources folder?

Shown below are images showing the issue
(I am aware of the typo in the name of the AssetBundle but as shown I used this same erroneous name in the AC speech settings):

Unity Console in 'Play' Mode -

The 'Speech' Settings on AC -

The 'Asset Bundle' (containing audio and LipSync data) -

The speech settings with the name of the bundle -

Comments

  • What's your AC version?

    The warning you're getting suggests that the asset bundle hasn't been loaded - the Resources folders are being searched because there is no asset bundle loaded to read from. Are you getting a warning further up the Console window about this?

    In the latest release, asset bundles are enabled via a dedicated drop-down field in the Speech Manager, and more information is given when it has issue locating an asset bundle.

  • Hi Chris,
    Thank you for your answer.
    Why would the asset bundle not load though? It is in the streaming asset folder.

  • edited May 2020

    .

  • What happened is that I changed the character speaker but did not change it in the ActionList Dialogue. The console messages are confusing.

  • edited May 2020

    How big are the bundles? They aren't always loaded in instantly - do they hold more than just the speech assets? If they're too large, they may not have finished loading before you trigger any speech actions.

    Again, what is your AC version? The latest release is better at reporting the state of your bundle.

    I changed the character speaker but did not change it in the ActionList Dialogue.

    I don't know what you mean by this. Do you have screenshots to illustrate?

  • edited May 2020

    HI Chris,

    • The AC version is 1.71.3 but I cannot spot the differences in the Speech Manager for the lipsync. I still have under 'Lip syncing' a dropdown list where I specify the technology used and then under Languages I have two fields for Audio Asset Bundle and for LipSync Asset Bundle

    • The only assets in the bundle are the Rogo data files and the audio files.
      In total, the size of the streaming assets folder is 183KB and the content of the asset bundle is 411.5KB

    • By "changed the character" I mean I created Dialogue ActionList and I populated the 'Speaker' field with that prefab. I then replaced this prefab with a different prefab but I forgot to re-populate the 'Speaker' field with the new prefab

    Since I am new to Unity and to AC I do not know if I need to manually load the asset bundle using a script or if AC loads the asset bundle automatically.
    I am now experimenting with manually loading the asset bundle.

  • The AC version is 1.71.3 but I cannot spot the differences in the Speech Manager for the lipsync.

    I wasn't referring to changes with the lipsync fields. With the new release, the Auto-name speech files? and Get speech from AssetBundles? options have been replaced with a single Reference speech files dropdown, which should be set to By Assest Bundle.

    In total, the size of the streaming assets folder is 183KB and the content of the asset bundle is 411.5KB

    OK, that sounds reasonable. Is "StreamingAssets" a direct subfolder of the Assets Directory? What does the Console now report?

  • Hi Chris,
    The dropdown Is indeed populated with 'By Asset Bundle.'
    Having put a script to load the asset bundle I got lipsync to work on my Mac. I do have lipsync and I do have audio that are loaded from the asset bundle.
    It does not work with WebGL. I am still getting errors that the archive cannot be loaded. I doubt this issue is with AC.
    Shown below is my script -

    `
    using System.IO;
    using System.Collections;
    using UnityEngine;
    using UnityEngine.Networking;

    ///


    /// Loads a given asset bundle
    ///

    ///
    /// Asset bundle must reside in the StreamingAssets folder and needs to be build to the
    /// target environment (such as Mac, Windows, WebGL, etc,)
    ///
    public class BundledObjectLoader : MonoBehaviour
    {

    [Tooltip("the URL of the asset bundle on the web")]
    public string undleUrl = "https://virtualescape.impressivewebsite.com.au/wp-content/unity-games/EscapeDemo/StreamingAssets/escape_room_intro";
    
    [Tooltip("The name of the asset bundle to load")]
    public string bundleName = "escape_room_intro";
    
    
    // Start is called before the first frame update
    private void Start()
    {
        loadAssets();
    }
    
    /// <summary>
    /// Loads AssetBundle
    /// </summary>
    /// <returns>IEnumerable AssetBundle</returns>
    private IEnumerable loadAssets()
    {
        string path = Path.Combine(Application.streamingAssetsPath, bundleName);
    

    #If UNITY_WEBGL && !UNITY_EDITOR

        UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(path);
        yield return request.SendWebRequest();
    
        if(request.isNetworkError || request.isHttpError){
            Debug.LogError(request.error);
            yield break;
        }
        DownloadHandlerAssetBundle.GetContent(request);
    

    #else

       var localAssetBundle = AssetBundle.LoadFromFileAsync(path);
        yield return localAssetBundle;
        var loadedBundle = localAssetBundle.assetBundle;
        if (loadedBundle == null)
        {
            Debug.LogError("Failed to load AssetBundle");
            yield break;
        }
        loadedBundle.Unload(false);
    

    #endif

    }
    

    }`

  • A quirk of Asset Bundles is that they are built per-platform. If you switch platform, you'll have to re-build the Asset Bundle.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.