Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: capture twice in a frame may flip the texture. #171

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ public void GetDesamplingSize(DesamplingRate rate, out int w, out int h)
/// </summary>
public void Capture()
{
// Capture only once in a frame.
if (m_IsCapturing)
{
return;
}
m_IsCapturing = true;
// Fit to screen.
var rootCanvas = canvas.rootCanvas;
if (m_FitToScreen)
Expand Down Expand Up @@ -500,6 +506,7 @@ protected void UpdateMaterial(bool ignoreInPlayMode)
static int s_EffectId2;
static int s_EffectFactorId;
static int s_ColorFactorId;
static bool m_IsCapturing = false;
static CommandBuffer s_CommandBuffer;

/// <summary>
Expand Down Expand Up @@ -565,6 +572,8 @@ void UpdateTexture()
_Release(false);
texture = capturedTexture;
_SetDirty();
// Capture completed.
m_IsCapturing = false;
}

}
Expand Down