AssetBundles with scenes; intersecting scene sets.

Hello,
I’ve wasted the whole day trying to solve this problem and couldn’t find any mentions about anyone having similar issues and thought that posting about it here could help somebody in the future.

The story:
I work on a game that’s gonna have episodes in it, each episode is a bunch of scenes build into one AssetBundle. The game loads the required AssetBundle from the main menu and loads it’s starting scene(it’s name I store myself).

The problem:
To have seamless transition between episodes (say, ep1 and ep2) we should load ep2. The problem was: I was getting the message “The file Ep2.unity3d has already been loaded in another AssetBundle” when calling LoadFromCacheOrDownload. I couldn’t wrap my head around it: all the places where the AssetBundles are loaded are thoroughly wrapped with Debug.Logs and apparently the Ep2.unity3d had never been loaded before.

The solution:
My two sets of scenes had one scene in common, the scene for player’s death. That was the culprit. I removed it and everything worked fine.

tl;dr:
AssetBundles built for streaming scenes that contain at least one common scene are gonna be in conflict when being loaded.

Not sure if it helps but what is with AssetBundle.Unload ?

Unloading already loaded scenes would solve the problem.

Using AssetBundle.Unload should help but it wasn’t a viable choice for me because it could cause unnecessary unload/load operation if the player would have wanted to play the same episode again.

Cache the asset bundle?