也不多废话,直接贴代码 如果需要引用ZXing的dll文件可以去官方下载也可以私信
引用空间里加上using ZXing;
private string QRCodenumner=string.Empty;//取二维码传来的信息
private Color32[] color;
private Texture2D EQRTex;
private IEnumerator NewEcode()
{
yield return new WaitForSeconds(0.1f);
//string str = "/Photoes/QECode/" + "this"+ ".jpg";
BarcodeReader reader = new BarcodeReader();
//QEcode是我个人存储二维码的路径 string QECode = Application.dataPath + "/Photoes/QECode/" + Time.time +"E" +".jpg";
WWW www = new WWW("file:///" + QECode);
yield return www;
if (www.error==null)
{
EQRTex = www.texture;
// EQRTex = www.texture;
if (color == null)
{
color = EQRTex.GetPixels32();
Result result = reader.Decode(color,EQRTex.width,EQRTex.height);
yield return result == null ? "" : result.Text;
QRCodenumner = result.Text;
Debug.LogError(result.Text);
yield return new WaitForSeconds(0.1f);
color = null;
}
}
else
{
Debug.LogError("read error");
}
Resources.UnloadUnusedAssets();
}
6475

被折叠的 条评论
为什么被折叠?



