mcpiroman / UnityNativeTool

Allows to unload native plugins in Unity3d editor
MIT License
184 stars 19 forks source link

Enable use outside of play mode #12

Closed rogerbarton closed 4 years ago

rogerbarton commented 4 years ago

Works when native functions are called in edit mode. This can be useful when writing native dlls for the editor, e.g. custom model importer. The unloading is currently done in OnDisable, which may not be ideal.

mcpiroman commented 4 years ago

Another question is whether this should always run in edit mode, and I think it shouldn't. There is always some overhead, in big code bases this might even briefly freeze editor. So I'd add an option to enable it (disabled by default), something like enableInEditMode.

rogerbarton commented 4 years ago

We can use OnEnable or playModeStateChanged when we enter play mode to setup, based on enableInEditMode.

rogerbarton commented 4 years ago

Is there still something left todo in this PR? I've been using this and it works for me.

mcpiroman commented 4 years ago

Thanks!

rogerbarton commented 4 years ago

Thanks for reviewing!