Alexfedel
Alexfedel

Reputation: 31

Unity scene empty after loading Asset Bundles

I'm creating an AssetBundle in Unity containing one scene with the following code:

string[] scenes = {"Assets/Scenes/main.unity"};
BuildPipeline.BuildStreamedSceneAssetBundle( scenes , "main.unity3d", EditorUserBuildSettings.activeBuildTarget);

I have an empty intro scene that loads the main scene at the start of the app on iOS:

using (WWW www = WWW.LoadFromCacheOrDownload (url + "main.unity3d", 0)) {

while (!www.isDone) {
    yield return null;
}

//check if server response is an error
if (www.error != null) {
    throw new Exception ("WWW download had an error: " + www.error);
}

//Load the asset bundle
AssetBundle bundle = www.assetBundle;
bundle.LoadAllAssets ();

}
Application.LoadLevel ("main")

The problem is that the main scene is correctly loaded, but the 3D objects in it ( FBX files + textures ) can not be seen . The main scene has no scripts , only 3D objects , including simple cubes of Unity , which have been stored as prefabs in the Assets folder . What could be wrong , that the 3D data are not displayed ? The Asset Bundle itself has around 20MB , which by size definitely the 3D objects should contain . I use Unity 5.2.4 and it is only a problem in iOS , Android is working and the objects are displayed normally .

Upvotes: 1

Views: 1088

Answers (1)

Alexfedel
Alexfedel

Reputation: 31

I found the solution. You have to turn off "Strip Engine Code" in Unity

Upvotes: 2

Related Questions