webCamTexture.requestedHeight
时间: 2024-02-04 09:04:33 浏览: 33
`webCamTexture.requestedHeight`是一个只读属性,用于获取请求的WebCamTexture高度。这个值表示你在创建WebCamTexture时请求的高度,而不是实际摄像头图像的高度。
要获取WebCamTexture实际的高度,可以使用`webCamTexture.height`属性。它返回当前WebCamTexture图像的实际高度。
以下是一个示例代码,演示如何获取WebCamTexture的请求高度和实际高度:
```csharp
// 创建WebCamTexture对象
WebCamTexture webCamTexture = new WebCamTexture();
// 设置请求的高度
int requestedHeight = 480;
webCamTexture.requestedHeight = requestedHeight;
// 获取请求的高度和实际高度
int requestedHeight = webCamTexture.requestedHeight;
int actualHeight = webCamTexture.height;
Debug.Log("Requested Height: " + requestedHeight);
Debug.Log("Actual Height: " + actualHeight);
```
通过将所需的高度分配给`webCamTexture.requestedHeight`,你可以设置WebCamTexture的请求高度。然后,你可以使用`webCamTexture.height`来获取实际的摄像头图像高度。
希望这对你有所帮助!如果还有其他问题,请随时提问。