private IEnumerator HostSubmitFrame()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            if (screenshot != null)
            {
                Destroy(screenshot);
            }

            screenshot = ScreenCapture.CaptureScreenshotAsTexture(1);
            UnityNative.UnitySubmitFrame(Parsec.GetPointer(), screenshot.GetNativeTexturePtr());
            GL.IssuePluginEvent(UnityNative.UnityGetRenderEventFunction(), 1);
        }
    }
Ejemplo n.º 2
0
    private IEnumerator SubmitFrame()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            //Debug.Log($"Submitting frame received at {Time.time}");

            if (viewportTexture != null)
            {
                Destroy(viewportTexture);
            }

            viewportTexture = ScreenCapture.CaptureScreenshotAsTexture(1);
            UnityNative.UnitySubmitFrame(parsec.GetPointer(), viewportTexture.GetNativeTexturePtr());
            GL.IssuePluginEvent(UnityNative.UnityGetRenderEventFunction(), 1);
        }
    }