Continuous QR-Code scanning in Unity3D using Vuforia and ZXing

For a current project i needed a qr-code scanner that runs in continuous mode in Unity3D.For decoding barcodes, the library offers a possibility to integrate quite easily in Unity3D. That beeing done we need the image stream to be processed.

After searching quite a long time i came with two possible solutions.

Unity3d WebCamTexture

Unity provides the possibility to get a camera and show it’s input on a webcamtexture. You can find more documentation about it here.


  • Directly integrated in Unity
  • The webcam can be attached to a unity-UI element, which allows us to show the webcam stream where we want it in the size that we want.


  • No focus-options for the camera. The camera will have no autofocus whatsoever. (Perhaps this could be added with a native plugin?)
  • Ratio, Resolution and all the settings have to be done by yourself.


Vuforia is an augmented reality library which does all the heavy lifting stuff for tracking markers, images and 3d-objects. It’s quite a bit of overkill to use it, since we only need the camera-stream, but it offers some possibilites the webCamTexture does not. It’s also a lot faster…

You can get it after signing up here.


  • There is already an explanation for how to integrate Vuforia, on which i based my own solution:
  • Vuforia does all the platform stuff and you only have to handle the Image Stream, which makes it quite fast
  • A Texture is provided along with the ar-camera that shows the videostream
  • Continuous Autofocus or repeated Autofocus possible


  • Vuforia is not free (but i can live with the watermarked version for now
  • Another 3rd Party plugin…

Actual Implementation

I decided to go for the Vuforia option because

  • I needed fullscreen camera feed anyways
  • Faster and easier to implemented
  • Watermark doesn’t matter in my case

So building on the solution golB s’ydairA the steps to get all integrated is:

  • Get the vuforia unity package (you can download it after signing up) and import it into your Unity3D package.
  • Download for Unity3D or get the unitypackage from golB s’ydairA blog post (you will need to do some adaptions here)
  • Drag the ARCamera prefab from the vuforia folder into the project and enter the license key (you can get one from the vuforia portal)
  • Use the CameraImageAccess.cs file you can find attached here and drag it on the ARCamera
  • Optional: Create a UI-Text element and assign it the CameraImageAccess ScannedText field to show a scanned text when running the app

On to explain the ImageAccess file, which is essentiall quite simple:

Final Comments

  • The above code scans for multiple barcodes, if you only need one you can just use a QRCodeReader directly, which makes processing a bit faster
  • I’ve only tested the code on my android device, but theoretically it should work on iphone and windows too, because vuforia is cross-platform compatible and too.
  • The vuforia camera with the current (2015-12-18) unitypackage will not work under Unity3D64bit in the editor, because it was compiled for the 32bit version. To work around that i had to install the 32bit version of Unity3D. Perhaps they add a 64bit version in the future…

3 thoughts on “Continuous QR-Code scanning in Unity3D using Vuforia and ZXing

  1. hey, I was so impressed by your work! so, I’m also trying to decode QR code on Android device using Unity. But still I couldn’t find the way. I just followed your implementation steps and I think i got close to it but still it’s just got failed…. and your download link is not working :(..
    I’m developing this as a homework from school, so I’m asking you to help a bit… could you send me the whole code of your CameraImageAccess or check the link is working, plz? Thanks a lot in advance!

    1. Hi Seona,

      I fixed the download link, hope this helps. Do you use the vuforia sdk too? Decoding barcodes is also possible with the webcamtexture from unity3D as source (though it seems it’s quite slow). Do you know where your code fails?

Leave a Reply

Your email address will not be published. Required fields are marked *