fix light issue and dispose IPC after wacvr closed
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
{
|
||||
"name": "IPCManager"
|
||||
}
|
||||
"name": "IPCManager",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:e9ef0e10f8c2b264e9705f57f028b9e8"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -52,6 +52,37 @@ public class IPCManager : MonoBehaviour
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
Debug.Log("Disposing IPC");
|
||||
//CallAfterDelay.Create(0.1f, () => {
|
||||
//StartCoroutine(DisposeWait());
|
||||
//});
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private static IEnumerator DisposeWait()
|
||||
{
|
||||
IPCManager.sharedBufferAccessor.Write(244 + 3, 0); // Clear the flag
|
||||
yield return new WaitForSeconds(0.1f); // Wait if the IPC is still in use
|
||||
IPCManager.sharedBufferAccessor.Read<byte>(244 + 3, out byte flag); // Get the flag again
|
||||
if (flag == 0)
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private static void Dispose()
|
||||
{
|
||||
if (sharedBuffer != null)
|
||||
{
|
||||
IPCManager.sharedBuffer.Dispose();
|
||||
IPCManager.sharedBuffer = null;
|
||||
IPCManager.sharedBufferAccessor = null;
|
||||
IPCManager.isInitialized = false;
|
||||
}
|
||||
Debug.Log("IPC Disposed");
|
||||
}
|
||||
|
||||
public static void SetTouchData(bool[] bytes)
|
||||
{
|
||||
EnsureInitialization();
|
||||
|
||||
Reference in New Issue
Block a user