I made a couple of examples with assetbundles, where a cube object has a texture assigned to it + a script to make it rotate over time.
so 1 cube, 1 texture and my rotate.js script.
These things are then turned into an assetbundle (scripts in assetbundle example) and I load the assetbundle from the assetbundle demo application.
Now I discovered that SCRIPTS don’t seem to load from inside an assetbundle.
However, when I put the script (called it rotate.js) in the project it works.
Now this confuses me.
First thing I have understood is that scripts should stay in the project on compilation of the main unity3d webplayer or standalone.
But… why exactly?
If I’m not mistaken, then unity3d automatically knows which assets are needed by a program and includes only those things from the project which are effectively used.
Unity3d doesn’t know what script my assetbundle wil need? So how can it work? And where is the javascript saved then? In the assetbundle or in the main webplayer/standalone.
This can be a big difference, because if you have 1 main movie and 100 assetbundles with scripts, then it would mean 1 of 2 scenarios
-
All scripts are compiled and stored inside the main webplayer/standalone and not in the assetbundles (this would mean that the main webplayer/standalone would get quite bigger, because 100 assetbundles with for example each 10 scripts doing stuff = 1000 scripts in the main webplayer/standalone.
-
OR… The scripts are NOT put in the main application/webplayer, but just some kind of reference to them and the actualy scripts are effectively saved within the assetbundles themselves, which results in the size of the scripts being dispersed over the different assetbundles and a relatively smaller main webplayer/standalone.
Any extra information about that would be greatly appreciated.
Regards, Thanks,
Bart