- Home /
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.
Can you share your existing script so that we can guide you in the right direction? Sometimes it can be that you are actually doing it right but a few $$anonymous$$or errors can make you believe you are doing it wrong and can set you on a different path.
You can also provide some information as to how you have set your assetbundles and how you have implemented your thing.
Answer by SaraCecilia · Dec 04, 2014 at 02:39 PM
http://answers.unity3d.com/questions/44013/refenced-script-on-this-behavior-is-missing.html
I already know the reason why I am getting the referencing error. $$anonymous$$y question was how to assign the scripts for each object within the scene.
Your answer
Follow this Question
Related Questions
Working example of loading scene as asset bundle in Android!? 0 Answers
Any way to stream 3D GameObjects on Unity Basic? 0 Answers
Asset bundles caching.IsversionCached() always returns false 1 Answer
Asset Bundle Dependencies, Unity 5 0 Answers
Default Sprite Shader is missing from prefab loaded from asset bundle? 0 Answers