Resource Folder Mechanics

Lets say that during custom build process I rename my “Assets/Resources” folder to “Assets/ExcludeResources”. My whole GameObject hierarchy is dynamically created at run-time: only one master GO is static and it references no assets. I expect that none of the assets from “ExcludeResources” will be added to the default asset bundle. Correct? For release builds I want to load everything from custom asset bundles. I do this so that I can manage memory fully dynamically.

Yes, that sounds to me like it should work. Folders named “Resources” are special, included in the build whether you reference their contents or not. “ExcludeResources” is not such a special name, so it should be ignored by the build system.

If you are using assetbundles, then you really don’t need the resources folder at all. Renaming/moving would an unnecessary step . You can put your assets (that are tagged for bundling) anywhere normally in your project, and they will be excluded automatically when building.

2 Likes

This. There is no real reason to use Resources at editor time. Why not just use the bundle the whole way through?

I’m new to that bundle thing.

Are bundles made for builds run in the editor? I mean when I tag something for bundling I still have to instance it manually through scripts in some other way than “Resource.Load”.

In release build I would create an AssetBundle object based on my bundle file and then I could load my assets. In the editor I need to kind of simulate that bundle. How?

No, you don’t want handle things differently in editor than in build. If you are using assetbundles, then you want to load them in the editor. This means you don’t have extra/conditional code, and it ensures that your bundles and code are working as you expect in the build.

There are two ways to do it. First is just to have a different url depending on if you are in editor or production. (this can be either a local file path or remote if you are running a local server). This is useful in some situations. If you are working in a team, or generating bundles from other projects. It is a little slower, as you have to generate and push the bundles to that location to see changes when you run. But it is faster if you are primarily working the content. For example, if you are building to a device, and you just need to update bundles and have a local server, you can just update the bundles, you don’t have to do new device builds.

The second way, is to use simulation mode in the AssetBundle Manager. In simulation mode, the loads the content locally instead of from bundles. It makes building and testing much quicker.

There is a good tutorial here:

And the asset in the store has a demo project. It covers usage and things like variants and platform dependencies.

2 Likes