You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,13 @@
1
1
# UnityNativeTool
2
-
Tool designed mainly to solve old problem with unloading native plugins without reopening Unity editor, with vary little changes to code base and low overhead. It enables to replace plugin files between game executions or even while playing.
2
+
Tool designed mainly to solve old problem with unloading native plugins without reopening Unity editor; with vary little changes to code base and low overhead. It enables to replace plugin files between game executions or even while playing.
3
3
Doing so involves mocking original native method calls with these made to manually loaded libraries by P/Invokes. Although works in builded game, it's intended to use in edtior.
4
4
5
+
## Systems
6
+
- Windows
7
+
- Linux
8
+
- Mac (not tested)
9
+
5
10
## Requirements and dependencies
6
-
- Windows or Linux
7
11
-[Harmony](https://github.com/pardeike/Harmony) (already included in release package)
8
12
- Api Compatibility Level >= .NET 4.x
9
13
@@ -20,11 +24,11 @@ Tested on old gaming laptop, Windows 10, 2 plugins with 10 functions each. Targe
20
24
| Without this tool |~70ms |
21
25
| Lazy mode |~135ms |
22
26
| Preload mode |~105ms |
23
-
| With thread safety |~300ms |
27
+
| With thread safety*|~300ms |
24
28
25
29
*With uncontended locks.
26
30
## Instalation
27
-
1. Download and add unity package from releases.
31
+
1. Download and add unity package from [releases](https://github.com/MCpiroman/UnityNativeTool/releases).
28
32
29
33
2. Set _Api Compatibility Level_ to .NET 4.x or above.
30
34
Edit > Project Settings > Player > Other Settings > Api Compatibility Level
@@ -47,11 +51,11 @@ All plugins under controll of this tool will be unloaded once game stops. To unl
47
51
48
52
#### __Options__
49
53
These options are editable via `DllManipulator` script.
50
-
*__DLL path pattern__ - Path at which mocked plugin files are located. Default is *Assets/Plugins/\__NameOfPlugin[.dll|.so]*. Can be the same as path that Unity uses for plugins.
54
+
*__DLL path pattern__ - Path at which mocked plugin files are located. Default is *Assets/Plugins/\__NameOfPlugin[.dll|.so|.dylib]*. Can be the same as path that Unity uses for plugins.
51
55
*__DLL loading mode__ - Specifies how DLLs and functions will be loaded.
52
56
+_Lazy_ - All DLLs and functions are loaded as they're first called. This allows them to be easily unloaded and loaded within game execution.
53
57
+_Preloaded_ - Slight preformance benefit over _Lazy_ mode. All DLLs and functions are loaded at startup. Calls to unloaded DLLs lead to crash, so mid-execution it's safest to manipulate DLLs if game is paused.
54
-
*__[Linux only] dlopen flags__- Flags used in dlopen() P/Invoke on Linux systems. Has minor meaning unless library is large.
58
+
*__dlopen flags [Linux and Mac only]__- Flags used in dlopen() P/Invoke on Linux and OSX systems. Has minor meaning unless library is large.
55
59
*__Thread safe__ - When true, ensures synchronization required for native calls from any other than Unity main thread. Overhead might be few times higher, with uncontended locks. Available only in Preloaded mode.
56
60
*__Mock all native functions__ - If true, all native functions in current assembly will be mocked.
57
61
*__Mock native calls in all types__ - If true, calls of native funcions in all methods in current assembly will be mocked. This however can cause significant preformance issues at startup in big code base.
@@ -126,6 +130,5 @@ class AllInOne : MonoBehaviour
126
130
- Native calls inlining
127
131
- Improved interthread synchronization
128
132
- Pausing on dll/function load error, allowing to fix depencency without restarting game
0 commit comments