Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting NullReferenceException when BarcodeScanner.Update() and BarcodeScanner.Scan() are called #45

Closed
SnehalJ1509 opened this issue Nov 28, 2019 · 1 comment

Comments

@SnehalJ1509
Copy link

Hi,

I am trying to integrate this plugin in my unity project and I am using 2019.2.5f1 editor. I have followed all the steps mentioned in the docs and copy pasted the code mentioned in the sample SimpleDemo.cs with few modifications for camera permission for iPhone (the code related to camera permissions can be added as an improvement).

After running the application in iPhone, I am getting the following exception:

NullReferenceException: Object reference not set to an instance of an object.
at Scene1.g__c_statusChanged|3_1 (System.Object sender, System.EventArgs e) [0x00000] in <00000000000000000000000000000000>:0
at System.EventHandler.Invoke (System.Object sender, System.EventArgs e) [0x00000] in <00000000000000000000000000000000>:0
at BarcodeScanner.Scanner.Scanner.set_Status (BarcodeScanner.Scanner.ScannerStatus value) [0x00000] in <00000000000000000000000000000000>:0
at BarcodeScanner.Scanner.Scanner.Update () [0x00000] in <00000000000000000000000000000000>:0
at Scene1.Update () [0x00000] in <00000000000000000000000000000000>:0

and same one when I tried to call the BarcodeScanner.Scan():

NullReferenceException: Object reference not set to an instance of an object.
at Scene1.g__c_statusChanged|3_1 (System.Object sender, System.EventArgs e) [0x00000] in <00000000000000000000000000000000>:0
at System.EventHandler.Invoke (System.Object sender, System.EventArgs e) [0x00000] in <00000000000000000000000000000000>:0
at BarcodeScanner.Scanner.Scanner.set_Status (BarcodeScanner.Scanner.ScannerStatus value) [0x00000] in <00000000000000000000000000000000>:0
at BarcodeScanner.Scanner.Scanner.Scan (System.Action2[T1,T2] callback) [0x00000] in <00000000000000000000000000000000>:0 at Scene1.scanQR () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.Events.UnityAction.Invoke () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.Events.InvokableCall.Invoke () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.UI.Button.Press () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1].Invoke (T1 handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, System.Boolean pressed, System.Boolean released) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.StandaloneInputModule.Process () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()

I have wasted hours trying to figure out the exact root cause of these issues and think it is something related to the statusChanged as it can be seen in exceptions and which traces back to BarcodeScanner.Update() and BarcodeScanner.Scan(). Hence finally raising this issue. It would be great if some solution is provided quickly. Really stuck with this.

@kefniark
Copy link
Owner

Project not supported anymore (Here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants