I created simple Unity application that allows to load different scenes downloaded from internet. It works great if a scene doesn't contain any scripts. If there is a script connected with GameObject it fails with the error:
If that scene is started as separate application script works without any problem, but if that scene is saved via BuildPipeline.BuildStreamedSceneAssetBundle I've got described error.
I load scenes via simple code:
The main script stays in scene, because I call DontDestroyOnLoad for it.
I checked this scenaria via Unity3D 3.5.0 and 3.5.1
Where I do a mistake?
Thanks a lot.
Scripts are not being included in asset bundles due to security reasons. References to scripts are, however.
If you built your scene bundle from the same project as your scripts exists in, then it should work. If you built the asset bundles in a separate project, those scripts can't be referenced and as a result it is expected not to work.
If you create your asset bundles from the main project that the scripts reside in, and that you load the asset bundles from and this fail, please consider submitting a bug report.
answered Apr 28 '12 at 12:52 AM