diff --git a/scripts/DllCallbacks.cs b/scripts/DllCallbacks.cs
new file mode 100644
index 0000000..2fcdc04
--- /dev/null
+++ b/scripts/DllCallbacks.cs
@@ -0,0 +1,35 @@
+namespace UnityNativeTool
+{
+ ///
+ /// A place to implement you custom callbacks.
+ ///
+ public static class DllCallbacks
+ {
+ ///
+ /// This is called whenever a dll has been loaded.
+ ///
+ /// The name without preceding underscores or file extension.
+ public static void OnDllLoaded(string dllName)
+ {
+ // Debug.Log("[dll] " + dllName + " dll loaded.");
+ }
+
+ ///
+ /// This is called whenever a dll is about to be unloaded.
+ ///
+ /// The name without preceding underscores or file extension.
+ public static void OnBeforeDllUnload(string dllName)
+ {
+ // Debug.Log("[dll] " + dllName + " dll unloading...");
+ }
+
+ ///
+ /// This is called whenever a dll has been unloaded.
+ ///
+ /// The name without preceding underscores or file extension.
+ public static void OnAfterDllUnload(string dllName)
+ {
+ // Debug.Log("[dll] " + dllName + " dll unloaded.");
+ }
+ }
+}
\ No newline at end of file
diff --git a/scripts/DllManipulator.cs b/scripts/DllManipulator.cs
index bbe41e1..c060e78 100644
--- a/scripts/DllManipulator.cs
+++ b/scripts/DllManipulator.cs
@@ -76,12 +76,14 @@ public static void UnloadAll()
if (dll.handle != IntPtr.Zero)
{
LowLevelPluginManager.OnBeforeDllUnload(dll);
+ DllCallbacks.OnBeforeDllUnload(dll.name);
bool success = SysUnloadDll(dll.handle);
if (!success)
Debug.LogWarning($"Error while unloading DLL \"{dll.name}\" at path \"{dll.path}\"");
dll.ResetAsUnloaded();
+ DllCallbacks.OnAfterDllUnload(dll.name);
}
}
}
@@ -424,6 +426,7 @@ internal static void LoadTargetFunction(NativeFunction nativeFunction, bool igno
{
dll.loadingError = false;
LowLevelPluginManager.OnDllLoaded(dll);
+ DllCallbacks.OnDllLoaded(dll.name);
}
}