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 /
avatar image
2
Question by Differentiable · Jan 19, 2012 at 05:30 PM · c#plugindll

Can't replace DLL file after running.

I've asked this question before, but due to the nature of these stack overflow-like forums, any modifications to the question do little to bring it to anyone's attention, and making substantial changes to a question are frowned upon.

So, I'll try asking this in a different way.

I need to replace a plugin DLL frequently, as it is part of the testing process. I build the DLL with MSC, and run it with a C# script in Unity. The problem is, after it is used only once by a script, the module remains in use until the editor is restarted (that is, I cannot delete or replace the file, either manually or through another program).

This tells me that the C# runtime that Unity is using is not releasing references to modules that are not in use after scene scripts have stopped running.

I wrote a little test module that produces a message box when DllMain gets called with DLL_PROCESS_DETACH. After I run and then stop a script that loads it, the message box does not pop up until I close the editor.

I understand that the runtime dynamically loads the script and its dependencies while the editor is running, and playing/stopping the game does not necessarily mean that any modules loaded by scripts are unloaded.

MY QUESTIONS ARE:

How can I force the editor to unload a module without having to restart it?

Is there a list of loaded modules somewhere I can access that would allow me to force an unload?

Comment
Add comment · Show 1
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 JLJac · Dec 17, 2017 at 10:03 PM 0
Share

Gah this problem is making development borderline impossible - have to restart unity editor after every code tweak! No solutions yet?

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by xCyborg · Feb 01, 2019 at 11:50 PM

Seven years later nothing has been done to address this issue.

It's impossible to iterate on testing plugins, why this is not addressed?

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
avatar image
1

Answer by Demigiant · Jan 19, 2012 at 05:44 PM

This happens all the time if you have placed your DLL in the "Assets/Plugins" folder. If the DLL is not truly a plugin but just an assembly, placing it into any other folder will fix this issue (almost - it will still happen from time to time, but much more rarely). If instead it's a true plugin, I apologize for the useless answer :P

Comment
Add comment · Show 1 · 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
avatar image Differentiable · Jan 19, 2012 at 06:11 PM 0
Share

It is indeed a plugin.

avatar image
1

Answer by Jashengmato · May 19, 2013 at 09:53 AM

Create a method to manually stop the threads and release all the resources.

Invoke this method in OnApplicationQuit.

This may work! :)

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

9 People are following this question.

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

Related Questions

Sending and receiving variable-length arrays to and from DLL 0 Answers

Multiple Cars not working 1 Answer

Problem importing a mixed-mode (C++/CLI) library 2 Answers

Win Store plugin causing internal compiler error 1 Answer

Distribute terrain in zones 3 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