I am building a simple 3D game and I am trying to make it as small as possible.
Currently I loading most of the 3D models (like characters) from an AssetBundle
that I have created.
The problem is when I try to compress a scene (with its baked data, like occlusion culling) to AssetBundle
I get the following error: "Cannot mark assets and scenes in one AssetBundle".
How can I do it?
currently for compressing the models I am using the BuildPipeLine
and the AssetBundleBuild
classes.
I have found that link but it didn't help.
Also found the function BuildPipeLine.BuildStreamedSceneAssetBundle
but it is deprecated…
As the error states "Cannot mark assets and scenes in one AssetBundle" you can not build your scenes and assets into one assetbundle by design. The two assetbundles are also inherently different from each other, preventing you from building a single assetbundle containing both a scene and assets (like 3d models).
What you want to do is create a seperate assetbundle containing your scene, and creating a seperate assetbundle containing your 3D models that is dependant on the scene assetbundle, and loaded in after the scene assetbundle is loaded.
On a side note it seems like you are still using the old AssetBundle pipeline. Unity has release a Unity plugin tool for the new assetbundle workflow, including a better build pipeline, and a nice UI for managing and inspecting assetbundles called the Assetbundle Browser Tool.
Using this tool you can easily make out which of your assets are giving issues and shows which bundles are scene bundles and which are asset bundles through icons (Scene assets show a little unity logo with black, assetbundles are blue).
It also has its own small debugger which will show any additional errors that will be caused by building said bundle. Making the entire workflow and debugging process alot smoother.