Pregunta

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:

The class defined in script file named 'XXX' does not match the file name!

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:

    WWW www = new WWW("file://" + file);
    yield return www;

    loadedBundle = www.assetBundle;
    Application.LoadLevel(name);

The main script stays in scene, because I call DontDestroyOnLoad for it.

I checked this scenario via Unity3D 3.5.0 and 3.5.1

Where I do a mistake?

Thanks a lot.

¿Fue útil?

Solución

Unfortunately, Unity3D blocks scripts in asset bundles due to security reasons, so my scenario won't work by definition

Otros consejos

You can include scripts in the asset bundle but they also have to be in the project that loads the asset bundle and the scripts in the asset bundle and loading project need to share a meta file.

If you build your asset bundle from the same project that loads it this should happen automatically. If you're using a separate project to build asset bundles you should use revision control to make sure these scripts stay in sync.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top