Page 1 of 1

How to Register AssetBundle to Dialogue System

Posted: Mon Sep 04, 2023 10:04 am
by Saper
Hi Tony

I have problem with using audio from assetbundle, I don't know how to reference assetbundle to register it in Dialogue system. Those are my scripts and assetbundles files.
Create_AssetBundle.png
Create_AssetBundle.png (228.36 KiB) Viewed 795 times
Register_AssetBundle.png
Register_AssetBundle.png (167.18 KiB) Viewed 795 times
Files_AssetBundle.png
Files_AssetBundle.png (11.11 KiB) Viewed 795 times

Re: How to Register AssetBundle to Dialogue System

Posted: Mon Sep 04, 2023 11:52 am
by Tony Li
Hi,

That code looks fine. Is it not working? Are you getting an error or warning in the Console window?

Re: How to Register AssetBundle to Dialogue System

Posted: Mon Sep 04, 2023 12:46 pm
by Saper
I can't put any of generated files in to reference field for assetBundles. And i don't know what i'm doing wrong

Re: How to Register AssetBundle to Dialogue System

Posted: Mon Sep 04, 2023 1:51 pm
by Tony Li
Sorry, I don't follow. Have you built your asset bundle? If so, then after using DialogueManager.RegisterAssetBundle() whenever the Dialogue System needs to load a file from your asset bundles it will use AssetBundle.Load(name, type). For example, if you use a sequencer command AudioWait(Player_7_42), the Dialogue System will attempt to load: AssetBundle.Load("Player_7_42", typeof(AudioClip)).

Another option that you might find simpler is to use Addressables.

Re: How to Register AssetBundle to Dialogue System

Posted: Mon Sep 04, 2023 3:46 pm
by Saper
After building assetbundle I tried reference those files to script and probably i'm doing something wrong or I forgot about something regarding Assetbundle
In_editor.png
In_editor.png (29.62 KiB) Viewed 759 times
In_editor2.png
In_editor2.png (16.87 KiB) Viewed 759 times

Re: How to Register AssetBundle to Dialogue System

Posted: Mon Sep 04, 2023 7:12 pm
by Tony Li
I missed what you were doing in that second script. Normally you'll create your asset bundle as a file in an editor script that builds asset bundles. Then, at runtime, you'll use AssetBundle.LoadFromFile() or AssetBundle.LoadFromMemoryAsync() to load the asset bundle. This will return an AssetBundle object that you can pass to DialogueManager.RegisterAssetBundle().