In Unity 2022.3.50f1, I encountered two issues with WebCamTexture:
- When I try to retrieve the
availableResolutionsfrom anyWebCamTexture.devices, the width and height are always (0, 0).
My code:
var webCamDevices = WebCamTexture.devices;
foreach (var camDevice in webCamDevices)
{
var resolutions = camDevice.availableResolutions;
Debug.Log(resolution.width + "," + resolution.height);
}
- When I set the
requestedWidthandrequestedHeightof the webcam using:
public WebCamTexture(string deviceName, int requestedWidth, int requestedHeight);
Regardless of the values I provide for requestedWidth and requestedHeight, the webcam always defaults to width = 1000 and height = 750.
These issues never occurred when I was using the previous version (2020.3.48f1). In that version, I could both retrieve camera resolutions and set the requestedWidth and requestedHeight correctly.
However, I had to upgrade my project from 2020.3.48f1 to 2022.3.50f1 because Application.OpenURL no longer works in iOS 18.
Does anyone know how to fix the webcam issues?
Unity version: 2022.3.50f1
Device: iPhone SE 2022 (iOS 18)