/// <summary> /// Raises the destroy event. /// </summary> void OnDestroy() { webCamTextureToMatHelper.Dispose(); if (cascade != null) { cascade.Dispose(); } if (rectangleTracker != null) { rectangleTracker.Dispose(); } if (faceLandmarkDetector != null) { faceLandmarkDetector.Dispose(); } if (faceSwapper != null) { faceSwapper.Dispose(); } #if UNITY_WEBGL && !UNITY_EDITOR foreach (var coroutine in coroutines) { StopCoroutine(coroutine); ((IDisposable)coroutine).Dispose(); } #endif }
/// <summary> /// Raises the destroy event. /// </summary> void OnDestroy() { if (webCamTextureToMatHelper != null) { webCamTextureToMatHelper.Dispose(); } if (cascade != null) { cascade.Dispose(); } if (rectangleTracker != null) { rectangleTracker.Dispose(); } if (faceLandmarkDetector != null) { faceLandmarkDetector.Dispose(); } foreach (var key in lowPassFilterDict.Keys) { lowPassFilterDict[key].Dispose(); } lowPassFilterDict.Clear(); foreach (var key in opticalFlowFilterDict.Keys) { opticalFlowFilterDict[key].Dispose(); } opticalFlowFilterDict.Clear(); if (faceChanger != null) { faceChanger.Dispose(); } if (faceMaskMat != null) { faceMaskMat.Dispose(); } #if UNITY_WEBGL if (getFilePath_Coroutine != null) { StopCoroutine(getFilePath_Coroutine); ((IDisposable)getFilePath_Coroutine).Dispose(); } #endif }