Quantcast
Viewing all articles
Browse latest Browse all 312

Loading scenes and scripts through assetBundles

I am making a social world game similar to simcity. On clicking on each building a mini game starts. Is it possible to have the mini game in a separate scene which can be downloaded through an assetbundle. I have tried the example given in Unity docs, but I get a referencing warning on the gameObjects with scripts on them, when they are loaded in the scene. Any idea on how this can be done ? EDIT : Here is the code I am using to build the scene into an asset bundle... [MenuItem ("Assets/BuildWebplayerStreamed")] static void MyBuild(){ string[] levels = new string[]{"Assets/Scene/AssetTest.unity"}; BuildPipeline.BuildStreamedSceneAssetBundle( levels, "SceneTest.unity3d", BuildTarget.WebPlayer); } This is used to load the scene : public string url = "http://192.168.1.113:8000/SceneTest.unity3d"; IEnumerator Start () { WWW www = WWW.LoadFromCacheOrDownload(url,1); yield return www; var asset = www.assetBundle; Application.LoadLevel("AssetTest"); } The scene contains 2 gameOBjects; a plane and a sphere. The sphere has a script on it which is missing a reference when loaded into the scene.

Viewing all articles
Browse latest Browse all 312

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>