I’ve broken up my map into 3 scenes which each have an associated asset bundle. In the Analyze view, I can see a lot of duplicate dependencies but no clear way to manually resolve the duplicates. The only option is ‘Fix All’. I do not want these dependencies dragged out into a separate bundle. I would like the first bundle to contain the only copy if its dependencies, the second bundle the only copy if its dependencies, and so on. This would be easy if I had a way to drag and drop these duplicate dependencies into the appropriate bundles, but with scenes, these are not clearly displayed anywhere. You can only move the scenes themselves. It would be nice if I could simply multi-select the duplicate dependencies and have some right click options like ‘Remove copies from other bundles’, ‘Save all copies in separate bundle’, and ‘Delete copy in this bundle’. Here is what my interface looks like:
Since those assets are used on scenes, they are built into scene data, that’s why you’re getting duplicates. You can’t have scenes reference objects in another scene. You could separate those assets into prefabs that are in one bundle and have your scenes in separate bundles.
Isn’t the only purpose of including a scene as an addressable so that the addressable system will bundle its dependencies? And so the scene can be updated remotely of course if need-be. I don’t see why several scenes shouldn’t be able to reference the same prefab. Having a static asset in an addressable scene should just reference the prefab’s address, no matter which scene it is called from. If there were ways to split up the scene dependencies in bundles, that would make sense. It seems it is just a feature that is yet to be implemented. Its obvious that the addressable system does the math under the hood on this one, but just hasn’t provided that bit of flexibility yet.
I think the problem that keeps developers scratching their heads with asset bundles and addressables is that all of us have such varied use cases that it is hard to wrap our heads around why someone else would prefer to do something different. I mean, most of the documentation and suggestions I’ve seen people make recommend just conjuring up assets anywhere you want, as if everyone is making really dynamic games where objects pop into being all of the time. Well, that might be the way your game works, but it is not the way my game works. All of my assets at this point are static and in the scene when it loads up. I’m not instantiating anything, and I shouldn’t have to put things in separate bundles and create fancy scripts to populate my scene when I have already dragged the prefab into the scene.
Edit: And just to clarify, I’m not talking about scenes included in the build settings. This is regarding having multiple scenes specifically excluded from build settings, all marked as addressable, duplicating the same dependencies if they happen to have the same ‘chair’ in all 3 scenes. I would prefer that chair to go into scene_bundle_1 and scenes and 3 can reference that chair from scene_bundle_1 instead of making their own copies.
You place your chair in a scene and that chair is buillt with the scene data for that scene. You can’t reference data in one scene from another scene. What if the dependant scene is not available? That basically breaks the scene.
You’re saying that you dragged the prefab into the scene, but you’re still getting duplicates. That’s probably because you didn’t assign that prefab to any bundle.
prefabs that are inside the scene (and nested prefabs/variant) gets unpacked at build time, and only the game objects remain. there is no concept of ‘Prefab’ at runtime.
if you want to have them as dependencies, you need to reference the prefab inside a serialized field and Instantiate
it at runtime
If you mark a scene as addressable and remove it from the build settings it will build all dependencies into a bundle. The scene doesn’t have to be called or referenced in any other way (doesn’t need to be loaded) and that bundle will still exist. Everything in that bundle should be accessible just like a regular bundle. It seems you guys are still talking about how regular scenes work.
yes but ‘dependencies’ are NOT the stuff directly inside the scene, including prefab instances.
dependencies are all referenced assets, e.g. meshes, textures, and prefab assets.
btw you need to explicitly mark an asset as addressable (and give it an address) to be able to load it directly (except folders, a folder will mark as addressable all of its contents instead of itself)
assets in a “dependency bundle” (i.e. referenced by an addressable asset/scene but not addressable itself) are loaded automatically when you load the parent (and ref-counted accordingly). they don’t have an address, therefore they are not addressable by default
I see, that definitely makes sense.
I suppose a feature request then would be to have the option to navigate the tree of dependencies to give dependencies their own addresses in the bundle.
A workaround for now would be to split the scene into prefab groups, and then make sure that i have all copies of each type of prefab within only one of the split scenes.
I wander, did you request this feature? It would be very helpful to understand structure of resulting bundle and prevent bugs with duplicates.
Actually, this could be done with Analyze → Unfixable Rules → Build Bundle Layout Tool