Skip to content

InvalidCastException and unable to update Origin subcomponent #236

@MeneHuber

Description

@MeneHuber

Hi,

I'm using Unity 6 (6000.0.40f1), AR Foundation v6.0.5, ARCore v6.0.5, ARCore Extension v1.49.0 (arf6), Cesium v1.16.0 and want to build an application that uses the Geospatial Creators/Anchors.

AR Session is in the scene and the ARCore Extensions Script has the reference to it.
When I build in the editor I receive the following errors:

InvalidCastException: Specified cast is not valid.
Google.XR.ARCoreExtensions.ARCoreExtensions.OnEnable () (at ./Library/PackageCache/com.google.ar.core.arfoundation.extensions@5d67cc82df20/Runtime/Scripts/ARCoreExtensions.cs:202)

NullReferenceException: Object reference not set to an instance of an object
Google.XR.ARCoreExtensions.Internal.ARCoreHandleExtensions.SessionHandle (UnityEngine.XR.ARFoundation.ARSession session) (at ./Library/PackageCache/com.google.ar.core.arfoundation.extensions@5d67cc82df20/Runtime/Scripts/Internal/ARCoreHandles/ARCoreHandleExtensions.cs:38)
Google.XR.ARCoreExtensions.ARCoreExtensions.Update () (at ./Library/PackageCache/com.google.ar.core.arfoundation.extensions@5d67cc82df20/Runtime/Scripts/ARCoreExtensions.cs:298)

And this warning:

Unable to update Origin subcomponent for AR Geospatial Creator Origin, the component adapter is null.
UnityEngine.Debug:LogWarning (object)
Google.XR.ARCoreExtensions.GeospatialCreator.ARGeospatialCreatorOrigin:UpdateOriginFromComponent () (at ./Library/PackageCache/com.google.ar.core.arfoundation.extensions@5d67cc82df20/Runtime/GeospatialCreatorRuntime/Scripts/ARGeospatialCreatorOrigin.cs:138)
Google.XR.ARCoreExtensions.GeospatialCreator.ARGeospatialCreatorOrigin:Update () (at ./Library/PackageCache/com.google.ar.core.arfoundation.extensions@5d67cc82df20/Runtime/GeospatialCreatorRuntime/Scripts/ARGeospatialCreatorOrigin.cs:129)

Additionally, I can build to my Android device* but I receive EarthState.NotAuthorizedErrors (I use key authentication, AR Core is enabled in the Cloud and in Unity, the key is also in the Geospatial Creator Origin).

Any ideas how I could get this to run?

  • Tried it on a Google Pixel 9 Pro, OnePlus 9, Samsung Galaxy S24+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions