Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by hoy_smallfry · Feb 01, 2013 at 10:30 PM · c#assetbundledllunload

AssetBundle.Unload(true) removes DLL references

I have made an asset bundle with prefabs. These prefabs reference scripts contained in a DLL and use the default Unity models. After importing the DLL in another project and loading the bundle, I instance the prefabs. Also, the DLL is only referenced by the bundle. Everything goes as expected, and at some point later, I unload the bundle completely.

When unloading happens, the primitive models remain. This is expected behavior of course, since they are not part of the asset bundle. However, I've noticed that the DLL scripts referenced are removed, even though they are not a part of the bundle.

My questions are:

  • Why does Unity remove the DLL references when the DLL is obviously not part of the bundle?

  • Does this mean that the library unloads as well?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Feb 02, 2013 at 12:54 AM 0
Share

Hmm that sounds really strange, because it's not so easy to unload a dll in .NET / $$anonymous$$ono. The only way is to load the dll into a new AppDomain and kill the whole AppDomain. Usually when you just add a dll to a project it's loaded into the default AppDomain and therefore can't be unloaded. Are you sure that the dll is gone? Have you tried to use AddComponent after your AssetBundle unload?

avatar image hoy_smallfry · Feb 04, 2013 at 07:53 AM 0
Share

See thats the thing - I dont know if the DLL is unloaded, but after unloading the bundle, the GameObjects that are left show $$anonymous$$onoBehaviour components with missing references where the DLLs scripts used to be. Is that normal behavior? Even more peculiar, if it is normal behavior, then why?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by hoy_smallfry · Feb 06, 2013 at 06:31 PM

Partial answer:

I just called this bit of code after unloading the bundle:

 string message = string.Empty;
 foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
 {
     message += assembly.FullName + "\n";
 }
 Debug.Log(message);

The assembly is still in the app domain, which answers my second question, but the first question is still a mystery.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

When do asset bundles unload? 0 Answers

Multiple Cars not working 1 Answer

Can not implicitly convert a unityEngine.GameObject from unityEngine.Coremodule.dll to unityEngine.GameObject from Unityengine.dll 1 Answer

When I build my game it gives me this error 'Assets/Builds/Build_0.01_Data/Managed/Assembly-CSharp.dll' shouldn't be queried by IsAssemblyCompatible, missing IsInternalOrCompiledAssembly check ? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges