Search code examples
c#unity-game-enginewebcam

How can I get camera details through Unity and C#?


I am trying to use the WebCamTexture property in Unity - Windows, Unity Version 5.2 at the time I am writing this. I can use WebCamTexture.height and WebCamTexture.requestedHeight.

But how do I find out what the user's camera is capable of? What if the user has a camera that isn't HD capable and I want to get a picture that's 1280x720? I'd love to hear your input for this.


Solution

  • Set the resolution you want to have. If it's not supported by the hardware it will use the closest supported value.

    The requested width, height and framerate specified by the parameters may not be supported by the chosen camera. In such cases, the closest available values will be used.

    http://docs.unity3d.com/ScriptReference/WebCamTexture-ctor.html