View Full Version : AssetBundles as Audio players

Lucky seven
09-20-2016, 07:25 PM
Just thought I'd post this one up as an example of the versatility of the New AssetBundles

If you ever wanted to add your own playlist to one of your games Its now very easy to stock an object with a selection of background ambience and Music tracks and then switch between them during your gaming session. In fact It took me longer to find 4 royalty free tracks to add to the radio than it did to make the Assetbundle :D.


Now there is certainly more room for improvement as currently the volume is controlled by the overall sound level setting.
and there is no way to set off an AssetBundles Loops and Triggers with scripted commands....

But I suspect we'll see a lot more functionality added to how we can interact with AssetBundles as time progress.


09-21-2016, 01:31 PM
Awesome :)

09-21-2016, 03:35 PM
If a player joins a server with the song already playing, does it play from the beginning? Does it play from the same point as everyone else hears it? Or does it not play at all?

Looking forward to trying this when there's more scripting capabilities.

Lucky seven
09-22-2016, 11:43 AM
If a player joins a server with the song already playing, does it play from the beginning? Does it play from the same point as everyone else hears it? Or does it not play at all?

Good Question...Short answer...No idea :rolleyes::D

But thinking about it as the information is effectively imbedded in an object rather than called from some external 3rd party source. if you enter a room mid way through a track I'd assume you'd start hearing it from that point rather than the beginning. Really in this format they're nothing more than super extended versions of the pick up and put down noises you here when you interact with objects on the table.

To test it out I'll put together another one (Humorously I didn't bother to save the last one :o ) and offer it up for people to try in a multiplayer environment.

Nothing beats a good bit of empirical testing ;)

09-22-2016, 12:11 PM
If the sound was activated with a trigger effect then when a player joins they will hear nothing because that is a fire and forget effect. Looping effects will play for them but it will start from the beginning of the loop (I sync what looping mode the object is on, not at what time). You would have to fire the loop / trigger effect to get everyone synced for a late joining player.

09-29-2016, 04:39 AM
I think this would be great for ambient sounds, like birds chirping. Can't wait to see what people come up with!

10-02-2016, 03:22 PM
I wonder if scripting + asset bundles could create a soundboard with buttons to press that then make certain sounds?

Lucky seven
10-02-2016, 03:45 PM
I'd say if/when scripting gains access to Assetbundle triggers then that is entirely likely to happen :)

10-02-2016, 05:04 PM
I wonder if scripting + asset bundles could create a soundboard with buttons to press that then make certain sounds?

I made this. When scripting allows triggering, I'll add a dashboard to control it. But for now you can use the right click menus to trigger or loop the sounds.


10-07-2016, 10:16 PM
If you have multiple such radios that all use the same model, how would you put the model in a Secondary AssetBundle and use that...?! Is that what your Looping Effect 0 is...?

10-11-2016, 08:37 AM
So here I am now trying my hand at making an own sound asset bundle. However, the Unity editor screen I get looks very different from the one presented in the knowledge base article. (yes I downloaded the exact same version mentioned there) Which makes its complexity feel even more overwhelming.
Is there an easy to follow tutorial that could help me create my own sound bundles?

Lucky seven
10-11-2016, 02:19 PM
Most of that difference's your seeing are cosmetic and down to the fact The Dev's are using the Pro rather than free edition. Baryonyx :)
and any difference that's not cosmetic won't impact on any of the stuff were doing with assetbundles.

I don't know if there are any tutorials out yet specifically made for this. But I can put you an asset Package together with it all laid out ready If you'd like.
Send it so it has an assetbundle ready to export in a project scene with some sample sounds set so you can see how its put together...

just let me know if its something your interested in :)

10-11-2016, 04:21 PM
Oh I would be very grateful if you would do that! :cool:

Lucky seven
10-11-2016, 05:18 PM
Right.... start a new Unity project and import the package in the link through the assets tab in the top bar. its got everything you need including the example TTS Package from github.

In the "Sound cube" folder I've created in the project panel I've put a prefab of a simple cube with a default material to hold the sounds. right click on it to bring up its contents in the Inspector panel and expand the "TTS Asset Bundle Effects (Script)" this is where your sounds will go.


Expand out the headers for each of the four sample elements and examine how the sounds are placed inside. You can swap the sounds out with any that are stored in your asset folder and you can increase the number of elements by raising the number in the "Size" slot at the top.

When its ready to go right click on the prefab. name the Assetbundle if it isn't named already and then select "Build Assetbundles" and that's pretty much it.

I've also added a working Assetbundle of the Prefab in the project so you can drop it in TTS to see how it works on the table.

just ask if you need anything your seeing explained. :)

10-11-2016, 08:39 PM
Many thanks, instructions are clear and to the point.

Just one problem: When I change the sounds in your sound cube 1 prefab and rename that, then try to build asset bundle again, all it does is rebuild the original one you made and not the one I changed it into. What's wrong?

Lucky seven
10-11-2016, 08:58 PM
O.k do this... Drag the cube prefab into the Hierarchy panel to create an instance of it in the scene...rename it...right click it to bring up its details in the inspector panel if they're not already visible...make your alterations to the sounds then drag it back into the prefab folder to create a new prefab of this new version.....then select this new prefab and give it a new assetbundle name in the bottom right window where it currently says "None" now right click it again and hit Build Assetbundles.

This way you've still got the original and you wont have to keep overwriting the same object and there will be no issue of building the wrong bundle by accident.

Also just to be clear when you create an assetbundle it is not automatically placed in the TTS Assetbundle folder in the mod section with the image and model folders but resides in the Unity Assetbundle folder for the project you created it in. You have to transfer it over...Which thinking about it might be what's happened here .

So open your Unity folder find this projects name ..open it and then open its Assetbundle folder to find your file :)

10-12-2016, 09:05 AM
Now it works perfectly fine. Thanks a ton. This really saved me a lot of work figuring all of this out by myself.

EDIT: I was looking for it in the right location, but it really just rebuilt the old one. But pulling it into hierarchy and back to prefabs and giving it an own assetbundle name fixed it.

Lucky seven
10-12-2016, 12:36 PM
That's great..:) you'll have to post up a link if you upload any of these to the workshop.....unless you've a terrible taste in music.. in which case keep them to yourself .:p

01-07-2017, 07:58 PM
Lucky Seven, if you have a moment I could use some help: I've followed all your steps above, but when I try to add the object into game I get an error saying....
"Object Reference not set to an instance of an Object"

Can't seem to wrap my head around getting it fixed.

01-08-2017, 06:46 AM
Hey, update: I was able to figure it out. Turns out I forgot to check the Mac and Linux thing in the Unity installer. Works now, many thanks!

Lucky seven
01-08-2017, 07:56 AM
Gad you Fixed it Obidammos :) Sorry I missed your first post. . . time zones were against you I'm afraid :)

If you have any more questions about this or any thing else to do with Assetbundles in General. Don't hesitate to ask .

05-02-2017, 12:15 PM
Hi Lucky Seven,

I'm brand-spanking new in working with unity, but I seem to have gotten your methods to work all the way to actually importing the cube into TTS. The steps I'm at are these:

1. Import the .unity3D file into TTS through the cloud manager in game.
2. Click the file once uploaded, which copies the address to the clipboard.
3. Create a new custom asset bundle, paste address in the text field.
4. Game crashes (see attached picture).

No idea what I'm doing wrong, do you have any advice?


Lucky seven
05-02-2017, 01:11 PM
Hey Sarpeadon Welcome to the community :)

Can't quite make out that error message in the Pic. . . What does it tell you ?

About your Assetbundle. How large is it ? and how many tracks have you added ?

Did you use the TTS Effects script to add in the triggers ?

Soon get to the bottom of it :)

05-02-2017, 02:36 PM
Thanks, man.

The pic just tells me that a crash has occurred, not even joking. I have the error logs and such but wasn't sure if I should post those.

The filesize is around 12mb, and the only thing I did to see if it would work thus far was simply switch out your fourth example song with one of mine. So it's still sitting at 4 songs.

I'm pretty sure I used the TTS effects script properly - see picture - but I am not 100% on that.


Whether or not you can help me, thanks for trying!

Edit: Why are my pictures attached so small? Is there a way to make them larger?

Here is the link to see the script stuff. (https://ibb.co/k7O7wQ)
Here is the link to the error picture. (https://ibb.co/dMky35)

Lucky seven
05-02-2017, 03:08 PM
I think your on the Wrong Version of Unity looking at your Image.

You should be Using Unity Version 5.3.4 or at a Pinch 5.3.8 as we recently had a Unity Upgrade for TTS but your on safe ground with the First one.

Follow the link to get more details.


and directions to the right Unity version.

05-02-2017, 09:07 PM
Alrighty so I feel dumb for not doing that part. I got that all working, and I even was able to properly import the cube into TTS.

Now the issue is that while I changed I believe the correct sound file (the number four slot) to use the music I was trying, it doesn't update and stays at the song you originally set it to.

Looks like this. (https://ibb.co/bX9VGQ)

Any ideas?

Lucky seven
05-02-2017, 10:58 PM
An assetbundle is created from the Prefab, that's the bit that's connected to the assetbundle name when you "build it" but if you make your alterations on an active object in the Hierarchy panel you'll need to make sure you apply these changes so they feed back into the Prefab your working object is created from . . . think of it as your working on a copy but need to transfer the alterations you make back to the original before you export it.

So once you make your changes in the inspector panel Top left corner click on "Apply" to make sure this is happening. Then try and build your assetbundle again. before we go any further :)

05-03-2017, 10:25 AM
Ah, I got it, thanks!

Different issue now, though. When I pull the asset bundle into TTS, it spawns two linked cubes that function as a single object, and it has 8 slots for music.

This is what I'm talking about. (https://ibb.co/nFs9t5)

Clearly I did something wrong, but I can't figure out how I managed to pull this one off.

Edit: Also, is there a way to edit the volume of the cube? I messed with the volume settings in TTS and none of the sliders had any effect on the volume of the sounds played from the cube.

Lucky seven
05-03-2017, 08:40 PM
This is One of two things, you've either duplicated the model in the scene and applied it to the Prefab before you built the Assetbundle and exported it.

Or you have two separate objects both assigned with the same Assetbundle name in your project so when you build. . . it builds both together as a single item.

Easiest way to find out is to select the Prefab you want to export and change its Assetbundle name before you build it. this way you can be sure your not accidentally sweeping up another prefab by mistake.

07-02-2017, 11:43 AM
I linked the soundfiles to the TTS asset bundle effects script, but now it just fails to load into TTS :(

Lucky seven
07-02-2017, 04:37 PM
Hey Judasilfarion, Welcome to the Community :)

Roll back a bit with this one.... What have you done ? give as much detail as you can.

07-02-2017, 05:05 PM
Hey Judasilfarion, Welcome to the Community :)

Roll back a bit with this one.... What have you done ? give as much detail as you can.

I opened up the SOUND CUBE EXAMPLE.unitypackage file in unity, deleted the original sound files in the sounds file, replaced them with my own, then I opened the Sound Cube 1.prefab object. I opened the trigger effects tab under TTS Asset Bundle Effects (Script), opened the sound tab under sound 1, replaced the audio with one of the sound files in the sound folder, and repeated this for sound 2, 3 and 4.

I renamed all the new sound files after the original ones

Then I built assetbundles, imported it into Tabletop Simulator cloud file manager, and pasted the link into an assetbundle. When I did that however the assetbundle failed to load.

Earlier I tried it without linking the audio files though, and it was imported just fine, but it didn't play any sound because the triggers weren't linked to anything

EDIT: It seems that the problem isn't that I did anything wrong, but rather that Tabletop Simulator doesn't like to comply. The first time I import an assetbundle it works, but any further attempts to import assetbundles results in failure until I restart the game.

02-22-2018, 03:58 AM
Thanks for this. To my knowledge this is still the only tutorial for making sounds.

Quick question, does the duration field matter for non-looping effects? I changed it anyway, but I'm just curious.

08-31-2018, 01:49 PM
Can we control the volume yet?

10-13-2019, 10:58 PM
Oh boy. This is the best tutorial I've found for doing importing sound effects in TTS and there haven't been responses from the author in over 2 years. Here's hoping someone can help me, because I have no idea what I'm doing.

I followed pretty much the same steps as Judasilfarion. Since it's 2019 now and there have been several updates to Unity since Custom AssetBundles started with Unity 5.6.5, I *assume* (possibly incorrectly) that using a newer version, like Unity 2019.2.9f1 would not be a problem. I guess I should also download the old version and try re-building everything there... Anyway. I created a total of 5 sound cubes, each with 5-15 sound effects linked in it. I started with the pre-fab sound cube provided by Lucky Seven, and adjusted the assets as described by Judasilfarion. Each time I clicked "Build Assetbundle" it created a new ".unity3d" object with the different filenames that I had chosen. Unfortunately, I did not have the foresight to save as a different project for each cube, and instead went through the process of "delete sound assets, upload new sound assets, rename and re-link each asset in the Inspector panel, rename everything" for each of the remaining 4 cubes. In the end, I have a Project/AssetBundles folder with my 5 ".unity3d" files.

When I go to upload them into TTS (Objects -> Components -> Custom -> AssetBundle), I can navigate to any of my files and upload it to the Steam Cloud (Main only, Secondary blank), click "Import", and a cube appears and falls through the table, then the "Custom AssetBundle" window pops open again with my Steam Cloud URL still in place. I can continue clicking "Import" and it just keeps looping the process. If I select the example "sound cube 1.unity3d" file to upload to the Steam Cloud, then click Import, I get a notice about the Shader not loading correctly but it still spawns the cube and it works as expected. I don't know what could possibly be wrong, other than my using a newer version of Unity.

EDIT: Well, I just downloaded Unity 5.6.5f, imported the Sample Sound Cube package, made my adjustments for my first (of five) cubes, built the AssetBundle, and tried importing it in TTS before continuing... And it worked! I guess it really does still have to be the old version of Unity. Good to know, for every else's future reference!