I have next workaround using RawImage for displaying Camera Stream with WebCamTexture:
Rect uvRectForVideoVerticallyMirrored = new(1f, 0f, -1f, 1f);
Rect uvRectForVideoNotVerticallyMirrored = new(0f, 0f, 1f, 1f);
Vector3 currentLocalEulerAngles = Vector3.zero;
----
----
----
if (webCamTexture && webCamTexture.width >= 100f)
{
currentCWNeeded = targetDevice.isFrontFacing
? webCamTexture.videoRotationAngle
: -webCamTexture.videoRotationAngle;
if (webCamTexture.videoVerticallyMirrored)
{
currentCWNeeded += 180f;
}
currentLocalEulerAngles.z = currentCWNeeded;
rawImage.rectTransform.localEulerAngles = currentLocalEulerAngles;
if ((webCamTexture.videoVerticallyMirrored
&& !targetDevice.isFrontFacing)
||
(!webCamTexture.videoVerticallyMirrored
&& targetDevice.isFrontFacing))
{
rawImage.uvRect = uvRectForVideoVerticallyMirrored;
}
else
{
rawImage.uvRect = uvRectForVideoNotVerticallyMirrored;
}
}