
What will actually work to include your script file within an asset-bundle is to write your code in a TextAsset file (.txt). Take a look at UnityEngine.AssetBundle class to load and unload bundles/assets. Now all files required should be store in the asset-bundle file, 'Edit' except script files. There is more information about How to build an asset-bundle. Now you can run a method to create the bundle for you, as the following : īuildPipeline.BuildAssetBundles(Path.Combine(Application.dataPath, "AssetBundleLocation"), BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows) Note : if you can't store them all in the same folder, just assign their asset-bundle tag manually for each asset (or subfolder) you want to add to the bundle. Your scene the client needs to download has to be in the same asset-bundle tag. Then you can assign the whole folder to a AssetBundle tag as should your scene be. you needs, depends on what is included in your scene, is to store them all in a folder. The way you can add all scripts/materials/. Script (.cs file) won't be able to be included in an asset-bundle. Var type = assembly.You can add any type of asset you want in an asset-bundle. Load the assembly and get a type (class) from it TextAsset txt = bundle.Load("myBinaryAsText", typeof(TextAsset)) as TextAsset

WWW www = WWW.LoadFromCacheOrDownload (url, 1) Note: Loading scripts from asset bundles is not supported on Windows Store Apps and Windows Phone. Monodevelop, Visual Studio) or any text editor using the mono/.net compilers. You can create your assemblies in any normal C# IDE (e.g.

If you want to include code in your AssetBundles that can be executed in your application it needs to be pre-compiled into an assembly and loaded using the Mono Reflection class (Note: Reflection is not available on platforms that use AOT compilation, such as iOS). AssetBundles can contain scripts as TextAssets but as such they will not be actual executable code.
