- Home /
Missing referenced script in game object loaded from asset bundle
I have a very simple Unity project containing one prefab. This prefab just contains a sphere with a custom monobehaviour attached to it.
I want to put this prefab in an asset bundle which I build using the following code:
Object sphere = AssetDatabase.LoadMainAssetAtPath("Assets\Bundle2\Sphere.prefab"); BuildPipeline.BuildAssetBundle(sphere , null, "Assets\bundle2.unity3d", BuildAssetBundleOptions.CompleteAssets);
Note that I don't use BuildAssetBundleOptions.CollectDependencies
because I don't want all the dependencies to be pulled in my asset bundle.
When I then load the asset bundle I get the following error message:
The referenced script on this Behaviour is missing! UnityEngine.AssetBundle:LoadAll(Type)
If I rebuild the asset bundle with the CollecDependencies option everything works fine.
I don't understand why CollectDependencies is required to make my script work. From what I understand script components are just references to classes defined in the main assembly.
Am I misunderstanding how asset bundles work?
Thanks,
Clem
I'm having a similar problem. For some reason the "CompleteAssets" option seems to lose all of my assets, while the CollectDependencies gets most.
same question, CollecDependencies include too many asset, just want script.
You don't put scripts in Asset Bundles , they need to be in the main build.
is it not possible to load assembly from bytes?
well i know it is not possible in iOS but other platforms it should be working. I havent tried though!! so not sure!
Answer by Cookiemonster · Sep 23, 2011 at 11:12 PM
Doesn't this mean there is an empty script on one of your assets ?? I don't know if this applies for this problem though.
Your answer
Follow this Question
Related Questions
How to import the object from server to unity 2 Answers
What environment would you like to see be sell in the Unity Asset store? 2 Answers
Unity Cache Size 1 Answer
Loading multiple Assetbundles causes a Crash 1 Answer
Is there any way to load a movie file from asset bundles for android only 3 Answers