- Home /
How to upload dll using package manager?
When I try to upload my extension using Package manager, I get the alert in the console that "Asset bundles can not include Editor Objects (DefaultAsset): Assets/mydll.dll"
I wonder why I am getting this message and how to overcome it, Thank you
Answer by hoy_smallfry · Feb 12, 2013 at 11:23 PM
Class libraries cannot be part of an Asset Bundle, partially because its a security risk to inject code onto your application from the internet (viruses, anyone?). The other reason is that the whole Asset Bundle mechanism mirrors what happens to non-script assets when you build them with a player - when you build, scripts become .dll files, and non-scripts become .asset files.
You could tackle this in one of two ways:
1) Leave the assembly as a part of the project; Don't worry, all your prefabs that link with the library classes will still properly link.
2) If your class library does not have any MonoBehaviour scripts, then it is possible to stream it from an website using the method AngryAnt used in his experiment Downloading the Hydra. This only works with libraries that don't have MonoBehaviours (or, more specifically, classes in the library that aren't MonoBehaviours), because all assets Unity refers to in serialized files have to be registered with the AssetDatabase in order for them to be properly referenced when deserialization happens. The whole thing AngryAnt does in his demo goes outside of the registry, and as far as I know, Unity doesn't provide a direct way to dynamically register assets with the database (aside from whatever happens inside AssetBundle functions).
It's frustrating, yes, but hopefully that clears it up for you.
You're basically right and i posted almost the same answer a couple of times ;) However it actually is possible to load assemblies with $$anonymous$$onoBehaviours at runtime. The important part is that the DLL must not use any namespace.
Usually when you build a DLL it uses it's own namespace. When you simply add a dll with a namespace into your project, Unity will "extract" all $$anonymous$$onoBehaviours it can find inside the DLL. However when loading the assembly manually this doesn't happen. So just remove the namespace from your DLL ;) I've managed to load $$anonymous$$onoBehaviours even within a webplayer ;) However that way with Unity 3.4 i guess. I haven't tried something like that recently. Since Unity4 "kind of" supports namespaces maybe something has changed now, but can't say for sure.
Your answer
![](https://koobas.hobune.stream/wayback/20220613092554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is there a way to prevent certain Asset elements from being included in a unity package? 0 Answers
Unity does not start - package manager error 0 Answers
Can't see "My Registries" window after i implement Firebase Scoped Registry! 0 Answers
Could not read from encrypted package file. [Trying to use asset store] 0 Answers
Package Manager Connect Erorr 2019.3 0 Answers