diff --git a/Runtime/SkyHookManager.cs b/Runtime/SkyHookManager.cs
index f7f9da4..22d874c 100644
--- a/Runtime/SkyHookManager.cs
+++ b/Runtime/SkyHookManager.cs
@@ -31,7 +31,7 @@ namespace SkyHook
///
/// Whether the hook is active now.
///
- public bool isHookActive;
+ public bool isHookActive => SkyHookNative.HookIsRunning();
///
/// Your callback for each key updated events.
@@ -90,13 +90,12 @@ namespace SkyHook
_callback = HookCallback;
var result = SkyHookNative.StartHook(_callback);
-
+
if (result != null)
{
exception = new SkyHookException(result);
}
- isHookActive = true;
started = true;
_mre.WaitOne();
@@ -113,6 +112,7 @@ namespace SkyHook
while (!started && exception == null)
{
+ Thread.Yield();
}
if (exception != null)
@@ -134,8 +134,6 @@ namespace SkyHook
{
_mre.Set();
}
-
- isHookActive = false;
}
///
diff --git a/Runtime/SkyHookNative.cs b/Runtime/SkyHookNative.cs
index 4032032..d283640 100644
--- a/Runtime/SkyHookNative.cs
+++ b/Runtime/SkyHookNative.cs
@@ -29,5 +29,12 @@ namespace SkyHook
/// null if no error, or an error message.
[DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)]
public static extern string StopHook();
+
+ ///
+ /// The native version of method handled by .
+ ///
+ /// null if no error, or an error message.
+ [DllImport(Lib, EntryPoint = "hook_is_running", CallingConvention = CallingConvention.Cdecl)]
+ public static extern bool HookIsRunning();
}
}
diff --git a/plugins/skyhook.bundle b/plugins/skyhook.bundle
index 32154ca..5f932af 100755
Binary files a/plugins/skyhook.bundle and b/plugins/skyhook.bundle differ