Asset Bundles - the best way to handle modding in unity?

I am about to begin an experiment in which core interactions are build into the core game but all of the assets and events that make use of the core interactions are loaded in through json (for data and events) and all of the models are loaded in via asset bundles, both of these in external folders for users to populate.

Asset bundles seem rather powerful, and now that anyone can make them in unity personal, it seems like a great solution to the well known problems (of the [year]2009-2013 threads I was reading) of loading models and other assets at runtime.

Is there any special practices I should be making use of? I see I need to use www to load these things… and I’ve already successfully created a cube + red material and loaded the cube prefab from the asset bundle and then unload(false)'d it afterwards… Is continually loading an asset bundle this way the same as continually loading objects with Resources.Load? Performance wise? Has anyone else done this for DLC/Modding purposes?

I’d love some feedback and to also stir up some noise about modding, cuz it’s the most wonderful part of gaming!

1 Like

My game features a pretty robust modding interface with an editor and everything. But in an attempt to basically recreate the Aurora Engine (Neverwinter Nights) in Unity, I’ve actually been making use of the StreamingAssets folder where I’ve created a “Data” directory that houses Modules, Sound Effects, TDA, Templates, Models, etc. That way there is an ease of access to what goes where.

I’ve never used Asset Bundles before, I’ve heard of them, but usually only in a negative light :(. The boys down at Obsidian have a tough enough time with them.

Needless to say I’d be very interested to know if Asset Bundles are the way to go and if I’m just progressively shooting myself in the backside (which is fun for a weekend but not really for my day-job).

Well it seems besides scripts, your asset can be rigged up and prepared in unity and then loaded via asset bundle. What other system can do that? It would appear that I can create just about any kind of asset in unity, export it as an asset bundle and then load it at runtime and get a fully functional unity-thing. What is asset streaming? It sounds very similar. The docs make it sound like it’s basically the same thing.

Hopefully someone who has used both can show up at some point and that

is a relic of unity < 5.0 in which asset bundles were performance heavy / memory heavy / pro only!

I heard the asset bundle loader isn’t guaranteed to be backwards compatible. I.e., old asset bundles may stop working if you build your game in a newer version of Unity.

Seconded! I’ll keep my fingers crossed haha. Looks like we could both benefit a lot from that kind of info. I was actually going to create a thread very similar to this but you beat me to it.

I know Unity Evangelists say that Asset Bundles are literally the greatest thing on the planet, but like I said, I’ve only heard that they are a major pain to deal with. If it’s as easy as you put it, I’d be happy to go along using it as well. I’m just much more used to a more intuitive system of exposing folders that you can place simple assets in to be referenced by your mods or your custom scripts. Back in the days of NWN we used an “Override” folder that would essentially replace any asset in the game with the same name as the asset placed in that folder. This let people replace textures/models/dialogue/code, etc.

Whatever the case may be, usability is really key here. Modding communities are just like any dev community, you can lead them to water but you’d better have an easy way of getting there or you’re going to lose some along the way :stuck_out_tongue:

Kind of depends on what the mods are, and if it’s other unity developers creating them or players.

Even if this is for other unity developers I would have my own tool that packaged everything into the bundle, I wouldn’t just let people create anything they want. Then I’d create a manifest to go with it. Manifest so I could say do an http request to a url containing mods, download the manifests only, and show a list of available mods with descriptions, version, etc… And then just download the ones the person actually wants.

I remember the first user mod we did in a game way back, it was actually a really simple game but had a ton of users. We had bets on when the first penis would show up. Took 4 hours.

I am ok with that. People generally expect that new versions of things broke older things when it comes to games :stuck_out_tongue: I’ll keep a backup of my core assets and simply remake the bundles when we get to Unity 5.x.breaks_a_lot

Time travel.

Well everything in unity gets packed into a few files. I would love to be able to ‘resources.load’ to some external but local folder. I dislike using WWW and having to track coroutines while I’m loading things.

For the most part this will be content, but I do want to have things like… a core function is ‘modvalue(string prop, int change)’ which users can reference in json files to define how things interact. Enemies can negatively affect health values, healing items can positively effect health items, trees can be defined to have no offensive ability but become a bunch of logs when killed, etc. I was really inspired by 7daystodie over the past week. Using xml files and block states you can create some really interesting mods.

I don’t even have a game in mind though. My experiment is going to be a 'build your own cluster f* of interactable content" lol. I want to see how much I can build up through ‘modding’ with only basic functions in place.

At least the game was getting attention haha

Well I have the game loading custom files from the StreamingAssets folder. I found out about it on accident since our audio guy had us switch to WWISE and that required using the folder for soundbanks. You can load just about anything from it. I haven’t tested it with models and whatnot, however. I just put my character templates in there and my 2da files as well.

I’ve never used WWW before. I came uppon it a few times in searches for different answers, but always just assumed it was something to do with online :smile:. I’m guessing it has more general uses than that, but I’m compulsively trained to think internet whenever I see www like that :p.

Yea I thought so too initially but you can do file:/// paths to get things inside your game folder that users have put there. And with asset bundles you can have a model setup in unity to be ‘unity ready’. You should try giving a model some mecanim animations and see what breaks when you load via streamingassets. I’ll do the same with asset bundles.

We’ll have our answer before someone comes by :smile:

–edit

We’ve been moved out of the general forum, dramatic ‘nooooo!’

Well, the visibility of this thread just got reduced by about 97.8%

1 Like

I’m watching - but I’m only an artist interested in seeing if your going to load in that gumby character… :smile:

1 Like

@Tomnnn I’ve been doing some digging into this and it seems you were initially right about AssetBundles being pretty much the only way to load in the more complex files such as models and unity scene files. I suppose it could be possible to use the folder hierarchy for that too if you created your own FBX importer as a C++ plugin. Though that would be a very extreme way of getting around what seems to be the only method of adding content to be loaded in at run-time.

This kind of throws the proverbial wrench into things but I think I can get away with handling the templates, dialogue files, and data arrays via the standard streaming method and then use Asset Bundles to handle the models/animations/textures?

Thankfully I have sound taken care of since I use an external plugin for that. Still seems like this could be made to be a bit more simple and user friendly. But I’ll take what I can get.

1 Like

What, the model I posted in the other thread about 3D => 2D? Calling it gumby is a compliment haha, at least that makes it sound like anything I did with that mess was deliberate.

Yea. Get everything hooked up on your prefab and then just load that prefab from the asset bundle. I didn’t need to load the texture separately or do anything extra. I made a cube, I made a material, I put the material on the cube, I put the cube and material in a folder, I made an asset bundle out of the folder, then I loaded the asset bundle and instantiated only the cube from it… and it had the material on it.

This might be true of animations as well. It might just load everything the prefab needs and then be safe to unload until you need it again. I have to wait until next sunday to test anything because at work we’re working 12 hour days 6 days a week right now… but when I have the time, I’m going to throw some animations onto the prefab, package everything I need into that folder, and see what happens.

User friendly asset bundles? That’s a pipe dream… get it… pipelines? heh. I feel like that pun was bad enough to call graham, the man himself, over and ban me, but I’m sure he’s busy.

Back on topic…

If this goes well, I see a bright future for unity mods. Maybe a little less bright than unreal mods thanks to what the ARK guys did, but still bright!

2 Likes

So, a little necro here.

Have any of you guys come to a conclusion about this?

Did you finish those projects of yours? If so, a little insight from experience might be extremely useful.

So which was superior? Tabletop simulator uses assetbundles so i would think theyre somewhat of a good choice

I’m told most of the kool kids are using Addressables nowadays. I’m not sure how well they dovetail with the modding community though, as they are more complex wrapper atop AssetBundles.