google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 400 forks source link

Null Reference Exception if tap on GameObject not meant to be manipulated #733

Closed jjaslow closed 4 years ago

jjaslow commented 4 years ago

SPECIFIC ISSUE ENCOUNTERED

DragGesture.CS and TapGesture.CS (maybe other gestures also) assign the TargetObject to the GameObject that is manipulated in the OnStart method. However this is done through gameObject.GetComponentInParent().gameObject

If a GameObject not intended to be manipulated is tapped then the Manipulator component is not found causing a Null Ref Exception.

I added a null check for the Manipulator to address this.

VERSIONS USED

rsfuller commented 4 years ago

Thanks for the report.

The manipulator component you refer to appears to be the UIElements.Manipulator. So, this appears to be a Unity UI issue instead of an ARCore one.

I am closing this issue for now, but if there is an interaction via the ARCore SDK that is causing a NPE, please let us know how to reproduce it specifically (with what sample app you are using if any) and reopen the issue. I would recommend upgrading to the latest version of the ARCore SDK for Unity (currently 1.18.0).