Asset Bundles + Prefabs + How to proceed

Hi, I am in Editor exporting sets of “time related” prefabs with its dependencies as asset bundles

  1. I’ve red scripts that are in prefab are not exported but its references are.

I have tested it and works, but know, I won’t to reduce my app size (for this reason I use bundles).

So I should start deleting every prefab already in bundles and its dependencies from project editor (including resource), am I right?

One of this dependencies are… the script attached, should then deleted or not¿?

Am I proceeding in right way with bundles and size reduction?

  1. Another question, the idea is to have bundles preloaded before its assets (most, prefabs and dependencies) are called for first time.

At the moment I download the assetBundle, associate in a Dictionary by name, and then when someone wants for example instantiate a prefab, it asks this class to give it this object.

Is this the correct way to proceed?
I have the doubt, because, before using bundles, every prefab was in the “Resource folder”, but now I should always accessing it through asking this class which have the bundles.
Is this right?, am I missing some other way to approach the export-import-use asset bundles?

Thanks in advance.

Well, already find a problem, so good that I ask this.

For every bundle with X prefabs withs its n dependencies (textures, meshes, etc) I should delete them from the project tab to the final web Package be smaller.
But what if want to change any properties or whatever from this prefabs?, texture, mesh, properties, etc?

I should create all again because I erased.

It is obvious that is something that I am not understanding!:sweat_smile:
Shouldn’t be a “don’t include this asset in build” command in editor?

Any help on this matter if really appreciate.

Really worries me that no one has never done this before.
¿Has anyone never pass through this assetbundle process?

How do you work when you have to erase all your project data?

You likely didn’t get answers cause your questions have been answered countless times already or are explained in the documentation:

  1. Assets not sued in scenes will not be added to the build (unless they are in resources folder). so no you don’t need to remove models that you used for asset bundles only :slight_smile:
    What you need to do is move them out of the resources folder to somewhere else, I normally have a _Prefabs folder

  2. Things with dependencies will normally end in the same bundle anyway unless you specify them not to be (dependency means present in a field of a component of the object). I would not recommend to specify a related and required asset to put it into another file unless the size really requires to do so, cause you commonly don’t get anything (they must all be present to build the object, just that it is now significantly more complex as you must manually reassign them depending on the structure of the dependency)
    Also preloading is a given thing, cause before the bundle is completely downloaded you can’t access it.

  3. No if you use asset bundles you no longer use Resources.
    Instead you ask the Asset Bundle to load them (www.assetBundle gives you the AssetBundle where you can call the corresponding functions on)

1 Like

Thanks, however I red “all” unity oficial AssetBundle information (script reference) which is “this function do this” and only few have examples. Maybe I am missing other “documentation” about bundle (functionality which should be better documented due that people pay to have it or at least as good documented as other ones that are so extensive).

Also I red most “unityanswers.com” bundles question which the only reference similar to my question were:
~2007 no supported prefabs in bundles, now do)
~2008-2010, web problems downloading, bundle not importing what exported (wrong position) and general problems like that, script not exported, etc

And the AssetBundle project is the same, non of this examples arise the “moving from resource working approach -to bundle type working aproach” case which I think is not so rare, cause you not start working with bundles when testing unity.

My confusion that now is resolved came for the side that

  1. I was not using bundles, however all information went into the unity3d file and ONLY prefabs were in resource folder and not sued scene asset so… other data was also added to the build.

  2. Now I am using bundles so why now this “other data” will be not added to build if there is no difference?

So the answer (If I understood you well:-P) is that in the 1) point, the “other data” was all the prefabs dependencies.

And finaly the “move to _Prefab folder” is appreciate, and can never came to this reasoning without the answer above ;).
Becasue ¿Why should I move the prefab elsewhere if I have all the other monstrous data?, now it makes sense :-).

By the way, could you show me one post in which anyone ask or documentation that say/suggest the “countless times already explained” :
-prefabs that where exported in bundles now should be moved to other place than resource folder, and not other data will be exported to build now, because they were exported before due they were prefabs’dependencies and prefabs were in resource folder and they add to the build NOT only what is in Resource folder but ALSO its dependencies which are IN OTHER FOLDERS - :smiley:

Anyway, thanks again :), if this was noob question, should be answer anyway, as most noob questions over the forum that are answered no matter its answer be “read documentation about x , it is there”.
Even more, why didn’t you just pass me the link to “that” post or “documentation” instead of writing down all that answer? at least, there was not.

I just got little bad about the “countless time” point, because all the real research that I have really made :frowning:

1 Like

Asset Bundles have 2 official example projects under support - resources - example project (the asset bundle and the char customization). Also its a pro only feature making it a far less common topic for example (the only thing even less common is likely plugins as they are pro only and standalone only)

And that it includes all dependencies of stuff in resources folder is clear. It must be able to reproduce the object completely as such it must include the complete assets required to do so or as you say it: all dependencies :slight_smile:

Ha!, you didn’t show me any post or link!, I won! :lol:
Just kidding :o, really, your answer was really appreciated except for the “countless time” part :slight_smile:

Thanks.

So I am going to say sorry for that, was potentially not appropriate in that case and definitely not helpfull

glad the rest helped

Good open honest chat and lots of interesting points and things from it. I’ve got the pro license to and have started using asset bundles. The biggest issue i have at the moment is being able to create them. I have a unity example code which makes all assets from clicking on a directory. Is it possible to get all those assets into a single bundle preserving their pathnames within the bundle?

Probably been answered countless times but not able to find anything at moment!

Moreover on this point to explain further. I have in the project folder a clothing folder with sub folders for the fbx imported mesh, a texture folder and a materials folder. What i want to achieve is one asset bundle e.g. shirt.unity3d with all the relative asset locations inside it so i can use either LoadAll, or Load to reference them. Is there a script around to allow me to do this?

Sorry that’s just been said too many times ! These are real issues which need solving usually just easy to say that !