简单的调用手机摄像 拍摄 然后识别二维码 显示二维码的内容
需要导入一个zxing.unity.dll文件,现在这个脚本的识别数据是放在Updata里边扫描的 数据量特别大会卡 要是用的话就自己做一下一秒执行一次。我这里没有弄
下载地址http://download.csdn.net/detail/chh19941125/8734149
代码:
using System.Threading;
using UnityEngine;
using ZXing;
public class WebCameraScript : MonoBehaviour
{
public string LastResult;
public string Lastresult;
public Color32[] data;
private bool isQuit;
public GUITexture myCameraTexture;
private WebCamTexture webCameraTexture;
private void Start()
{
// bool success = CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
// Checks how many and which cameras are available on the device
for (int cameraIndex = 0; cameraIndex < WebCamTexture.devices.Length; cameraIndex++)
{
// We want the back camera
if (!WebCamTexture.devices[cameraIndex].isFrontFaci