2

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…

SagiZiv
  • 932
  • 1
  • 16
  • 38

1 Answers1

2

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.

Remy
  • 4,843
  • 5
  • 30
  • 60
  • Thx for your reply, I tried to separate the scene from the 3D models, but I still get this error because the scene baked data is also an asset. can I separate it from my scene? – SagiZiv Nov 27 '18 at 12:54
  • What verison of Unity are you using? I thought baked lightning data was allowed in the same asset but may be wrong on that. You can always try to seperate it and load the baked data in manually as soon as the asset is loaded. – Remy Nov 27 '18 at 13:25
  • I am using Unity 2017.1.03f the occlusion culling data for example is in a folder next to the scene – SagiZiv Nov 27 '18 at 13:42
  • I have checked the plugin you recommended and it looks great, but it doesn't work as I need. In my project I don't always put all the models in AssetBundle, I have an external program that provides me the names of the models I need in a text file and then my code reads that file and compress the needed models. – SagiZiv Nov 28 '18 at 05:58