fix light issue and dispose IPC after wacvr closed
This commit is contained in:
parent
1db320fa5d
commit
a7ce4f3900
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@ public class Config
|
|||||||
public int TouchSampleRate = 3;
|
public int TouchSampleRate = 3;
|
||||||
public int HandTrackingMode = 1;
|
public int HandTrackingMode = 1;
|
||||||
public float Threshold = 0.3f;
|
public float Threshold = 0.3f;
|
||||||
public bool TouchPanelAirWall = false;
|
public bool TouchAirWall = false;
|
||||||
public bool UseIPCLighting = true;
|
public bool UseIPCLighting = true;
|
||||||
public bool UseIPCTouch = true;
|
public bool UseIPCTouch = true;
|
||||||
public float LightStrength = 1.35f;
|
public float LightStrength = 1.35f;
|
||||||
|
@ -171,6 +171,7 @@ public class ConfigManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
foreach (var configPanelComponent in _configPanelComponents)
|
foreach (var configPanelComponent in _configPanelComponents)
|
||||||
{
|
{
|
||||||
|
Debug.Log(configPanelComponent.ConfigKeyName);
|
||||||
var componentObject = configPanelComponent.Widget;
|
var componentObject = configPanelComponent.Widget;
|
||||||
if (componentObject.GetComponent<TMP_Dropdown>() != null)
|
if (componentObject.GetComponent<TMP_Dropdown>() != null)
|
||||||
{
|
{
|
||||||
|
@ -70,6 +70,13 @@ public class HandFollowManager : MonoBehaviour
|
|||||||
Vector3 rotationDeltaInDegrees = angle * axis;
|
Vector3 rotationDeltaInDegrees = angle * axis;
|
||||||
currentRigidbody.angularVelocity = rotationDeltaInDegrees * Mathf.Deg2Rad / Time.fixedDeltaTime;
|
currentRigidbody.angularVelocity = rotationDeltaInDegrees * Mathf.Deg2Rad / Time.fixedDeltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DistanceSnap()
|
||||||
|
{
|
||||||
|
transform.position = Target.transform.position;
|
||||||
|
transform.rotation = Target.transform.rotation;
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
gameObject.transform.localScale = Target.transform.localScale;
|
gameObject.transform.localScale = Target.transform.localScale;
|
||||||
|
26
Assets/Script/Essential/CallAfterDelay.cs
Normal file
26
Assets/Script/Essential/CallAfterDelay.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
// Code from https://forum.unity.com/threads/cant-run-my-coroutine-ondestroy.785756/
|
||||||
|
// Credit: Kurt-Dekker (https://forum.unity.com/members/kurt-dekker.225647/)
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class CallAfterDelay : MonoBehaviour
|
||||||
|
{
|
||||||
|
float delay;
|
||||||
|
System.Action action;
|
||||||
|
|
||||||
|
public static CallAfterDelay Create( float delay, System.Action action)
|
||||||
|
{
|
||||||
|
CallAfterDelay cad = new GameObject("CallAfterDelay").AddComponent<CallAfterDelay>();
|
||||||
|
cad.delay = delay;
|
||||||
|
cad.action = action;
|
||||||
|
return cad;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator Start()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds( delay);
|
||||||
|
action();
|
||||||
|
Destroy ( gameObject);
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Script/Essential/CallAfterDelay.cs.meta
Normal file
11
Assets/Script/Essential/CallAfterDelay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 52bc75ed574f3bd4ca7a24c6d17ab760
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -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;
|
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)
|
public static void SetTouchData(bool[] bytes)
|
||||||
{
|
{
|
||||||
EnsureInitialization();
|
EnsureInitialization();
|
||||||
|
Loading…
Reference in New Issue
Block a user