Search Unity

Feedback Debug Mode for Native C++ DLLs

Discussion in 'Scripting' started by Minchuilla, Sep 27, 2020.

  1. Minchuilla

    Minchuilla

    Joined:
    Feb 28, 2014
    Posts:
    16
    This relates to the fact that Unity does not unload native dlls, requiring restart if a dll needs to be recompiled and reloaded. For me the current workaround is the github UnityNativeTool by mcpiroman, to which I have also contributed. However, it would be nice if this was supported by Unity itself.

    The idea is to use a similar feature as the C# script Release/Debug mode, which can be enabled and disabled. However, doing this on a per dll basis.
    upload_2020-9-27_10-32-41.png

    So you could set, in the inspector of a dll, whether this is a dll being actively developed (Debug) or not (Release). This would determine when a dll is/can be unloaded.
    - Debug PlayModeOnly DLL, unloaded when exiting play mode
    - Debug RunInEditMode DLL, unloaded before entering playmode and when exiting
    - Debug Explicit DLL, unloaded by the user, via dll inspector or shortcut
    - 'Release' DLL, never unloaded (only unloaded once Unity is closed)

    Debug dlls are lazily loaded and release dlls can be preloaded.
    In a way, this is similar to the 'Enter Play Mode Settings'.