【发布时间】:2015-03-08 13:55:17
【问题描述】:
我无法在我的 Android 设备中旋转网络摄像头纹理。
这是我在编辑器中的场景:
这是我手机中的图片:
您可以看到手机和编辑器在旋转和缩放方面的差异。
代码如下:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Camera_pnl : MonoBehaviour {
//// Use this for initialization
WebCamTexture webCameraTexture;
void Start() {
GUITexture BackgroundTexture = gameObject.AddComponent<GUITexture>();
BackgroundTexture.pixelInset = new Rect(0,0,Screen.width,Screen.height);
WebCamDevice[] devices = WebCamTexture.devices;
foreach (WebCamDevice cam in devices)
{
if (cam.isFrontFacing )
{
webCameraTexture = new WebCamTexture(cam.name);
webCameraTexture.deviceName = cam.name;
webCameraTexture.Play();
BackgroundTexture.texture = webCameraTexture;
}
}
}
void Update () {
if (Input.GetKey (KeyCode.Escape)) {
Invoke("LoadGame",0.1f);
}
}
void LoadGame ()
{
webCameraTexture.Stop ();
webCameraTexture = null;
Application.LoadLevelAsync("Game");
}
}
如何解决此问题,以便我的手机显示网络摄像头纹理的正确旋转?
【问题讨论】:
-
你找到解决办法了吗?