deviceName | 使用しているデバイス名 |
requestedWidth | リクエストされたテクスチャの幅 |
requestedHeight | リクエストされたテクスチャの高さ |
requestedFPS | リクエストされたテクスチャのフレームレート |
WebCamTexture を作成する
WebCamTexture.devices を使用して、利用できるカメラ デバイスの名前のリストを取得します。デバイス名がコンストラクタに提供されない場合や、null 文字列で渡された場合は、最初に見つかったデバイスが使用されます。
パラメーターによって指定した幅、高さ、フレームレートは選択されたカメラにサポートされていない場合があります。そのような場合は、最も近い使用可能な値が使用されます。
Call Application.RequestUserAuthorization before creating a
WebCamTexture.
Note: using webcam texture on Android requires a device running Honeycomb (Android 3.0) or later.
Note: If you want to use a WebCamTexture to play the camera stream from a device connected through Unity Remote, then you must initialize it through use of the constructor. It is not possible to change the device later using WebCamTexture.deviceName from a regular device to a remote device and vice versa.
Note: For camera devices of kind WebCamKind.ColorAndDepth (currently these are only dual back and true depth cameras on latest iOS devices), it is possible to create a WebCamTexture instance to receive depth data using WebCamDevice.depthCameraName as the deviceName. This WebCamTexture always contains one channel and is in half-precision floating point format with distance values in meters.
If required, it is also possible to create a second WebCamTexture instance using WebCamDevice.name as deviceName to receive color data. In this case, both color and depth data will be synchronized.
Currently, iOS supports only limited combinations of color/depth data resolutions. requestedWidth and requestedHeight parameters are ignored, when creating WebCamTexture instances for ColorAndDepth devices. For iPhone 7+/8+ dual back cameras, the size of the WebCamTexture for color data is 1440x1080 and for iPhone X dual back and front true depth cameras, it is 1500x1126. The depth data resolution is always a maximum of 320x240 for iPhone 4+/8+/X dual back cameras and 640x480 for iPhone X front true depth cameras.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.