This project has moved and is read-only. For the latest updates, please go here.

Unity demo scene

Jan 27, 2014 at 4:00 PM
hello! i'm trying to use the unity demo scene (Unity 4.3) without success.

I can use the encode function successfully but when i try to decode something (i'm showing a qrcode to the webcam) i get this exception: "Object reference not set to an instance of an object" without other information (i think the exception is in the .dll).

What can i do?
Thank you.
Jan 27, 2014 at 8:41 PM
Do you have a stack trace of the exception?
Which version of unity did you try?
Jan 27, 2014 at 9:14 PM
unity 4.3.3

i don't have the stack trace, probably because the error comes from the dll (no line number or file at all).

I tried also to use source file, with no success (compilation errors). i tried to put all the file listed on the solution xml. actually i don't remember what compilation errors it gives to me (i'm not at office now).

Thank you for your time, i will provide more info tomorrow, eventually.
Jan 28, 2014 at 9:51 PM
Do you have a chance to attach a debugger (Visual Studio) to the process "Unity.exe" before you start the demo?
If you enable the option in visual studio to break at the point when an exception is thrown, you should get more information.
Jan 28, 2014 at 10:23 PM
actually i'm on osx. i could ask a friend to do this. he has more knowledge about windows ecosystem.
Jan 29, 2014 at 5:46 PM
on windows 8.1 and android, the demo works without problems...

not on osx inside the unity editor :\
Jan 29, 2014 at 7:42 PM
I don't have access to an osx system. I can't help you here. Sorry.
Feb 4, 2014 at 9:04 AM
Edited Feb 4, 2014 at 9:04 AM
same Mac problem here, it works fine up to unity 4.2.x but not on 4.3.x
Feb 6, 2014 at 5:54 PM
I am also having this issue on OSX. I'm not getting anything as an error...the Unity client demo just doesn't work anymore.
Feb 6, 2014 at 6:03 PM
I am also having this issue on OSX. I'm not getting anything as an error...the Unity client demo just doesn't work anymore.
Feb 7, 2014 at 5:46 PM
Still stuck. Any ideas on why it would work on PC but not on OSX?
Feb 7, 2014 at 6:34 PM
Edited Feb 7, 2014 at 6:34 PM
i wasted hours finding a solution and ended up downgrading back to Unity 4.2.2 and it all worked again, no cool solution but that was the only thing that worked for me…
Feb 7, 2014 at 6:50 PM
thanks for this info, i'll eventually keep two version of unity installed :)
Feb 7, 2014 at 6:56 PM
That's terrible! There has to be a better way than downgrading
Feb 10, 2014 at 1:12 PM
Edited Feb 10, 2014 at 1:13 PM
I think i know now what my problem is, since Unity 4.3.2 Webcamtexture is no longer supported, see here:

"Disable WebCam support in MacStandalone as it was using newly-deprecated APIs, which made publishing to the Mac App Store impossible. Web Cam support in mac standalone will come back in a future release."

Thats why zxing has nothing to decode in my case i guess…
Feb 10, 2014 at 2:19 PM
mmm it's true that is removed (infact you can't build the project as mac standalone) but inside the editor the webcamtexture works. if not, you couldn't see anything from camera (and with the provided example scene i can see myself recorderd from webcam) :)
Feb 10, 2014 at 3:53 PM
Yeah, but crap like that is always happening in the Unity Editor. It's like it has its own set of libraries that it uses to build the scene, but then when you go to build standalone or iOS you get a linker error. Thanks for the link UPHON. At least this makes a little bit of sense.
Feb 10, 2014 at 7:13 PM
I think I figured (some of) it out....maybe

In tracing the stored W & H values, I noticed that the initial dimensions of the texture were 16x16. Then, after a few frames, the width and height of the camTexture would jump up to the desired 640x480, but the values of W & H would never change. So, the barcodeReader would only be checking 256 (16x16) pixels of the actual 307200 (640x480) pixels. No idea why this worked before and suddenly doesn't work now, but just checking the cached width and height values and updating them as needed seems to work. Honestly, since camTexture is global for me, I will probably just replace W & H with camTexture.width and camTexture.height.

I hope this works for you!
Feb 10, 2014 at 7:15 PM
You can only call GetWidth from the main you still need W & H.
Feb 24, 2014 at 11:59 PM

I'm getting error when just trying to instantiane the BarcodeReader:

var barcodeReader = new BarcodeReader();

that's causing the unrecognized error. Unity doesn't throw anything, just stops the thread.
I'm working on Unity 4.3.4 and running the app on iOs7.

Any help will be appreciated.

Best Regards,
Feb 28, 2014 at 8:15 PM
Referencing to an older discussion
it could be a problem with generics and mono on iOS.
But I can't test it.
Someone with a iOS developer device should try to build a version of ZXing.Net which doesn't use generics.