EntryPointNotFoundException: ArSession_create assembly:
I am implementing Google AR Core API service on Unity 2023.2.3f1 with ARCore extension 1.41.0, AR Foundation 5.1.1, Apple ARKit XR Plugin 5.1.1, Google ARCore XR Plugin 5.1.1 to have cloud anchoring for shared collaborative experience among users to drawing.
I followed the installation guideline from the following website:
Install the ARCore Extensions package
However, in my newly created project, I encountered an error when I put AR Core Extensions as game object to the hierarchy as follow:
`EntryPointNotFoundException: ArSession_create assembly:
var status = ExternApi.ArSession_create(
_iosCloudServicesApiKey, null, ref _sessionHandle);
Google.XR.ARCoreExtensions.Internal.IOSSupportManager.get_Instance () (at ./Library/PackageCache/com.google.ar.core.arfoundation.extensions@7984b1776f/Runtime/Scripts/Internal/IOSSupportManager.cs:67)
_instance.CreateARCoreSession();
Google.XR.ARCoreExtensions.ARCoreExtensions.OnEnable () (at ./Library/PackageCache/com.google.ar.core.arfoundation.extensions@7984b1776f/Runtime/Scripts/ARCoreExtensions.cs:198) `
zFar = _cameraManager.GetComponent<Camera>().farClipPlane,
And this is related to the script IOSSupportManager.cs
Could anyone tell me what I need to edit or modify?? Many Thanks!
`//-----------------------------------------------------------------------
//
namespace Google.XR.ARCoreExtensions.Internal { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.XR.ARFoundation; using UnityEngine.XR.ARSubsystems;
#if UNITY_IOS && ARCORE_EXTENSIONS_IOS_SUPPORT using IOSImport = System.Runtime.InteropServices.DllImportAttribute; #else using IOSImport = Google.XR.ARCoreExtensions.Internal.DllImportNoop; #endif
internal class IOSSupportManager
{
private const string _iosCloudServicesApiKeyPath =
"RuntimeSettings/iOSCloudServiceApiKey";
private static IOSSupportManager _instance;
private bool _isEnabled = false;
private string _iosCloudServicesApiKey = string.Empty;
private ARCoreExtensionsConfig _cachedConfig;
private IntPtr _sessionHandle = IntPtr.Zero;
private IntPtr _frameHandle = IntPtr.Zero;
private ARSession _arKitSession;
private ARCameraManager _cameraManager;
public static IOSSupportManager Instance
{
get
{
if (_instance == null)
{
_instance = new IOSSupportManager();
#if UNITY_IOS && (!UNITY_EDITOR || UNITY_INCLUDE_TESTS) #if ARCORE_EXTENSIONS_IOS_SUPPORT _instance.CreateARCoreSession(); #else Debug.LogError("ARCore Extensions iOS Support is not enabled. " + "To enable it, go to 'Project Settings > XR > ARCore Extensionts' " + "to change the settings."); #endif #else Debug.LogError("IOSSupportManager should only work on iOS platform."); #endif }
return _instance;
}
}
public IntPtr ARCoreSessionHandle
{
get
{
return _sessionHandle;
}
}
public IntPtr ARCoreFrameHandle
{
get
{
return _frameHandle;
}
}
public void SetEnabled(bool enabled)
{
_isEnabled = enabled;
}
public void UpdateARSession(ARSession session)
{
if (session == null)
{
ResetARCoreSession();
}
_arKitSession = session;
}
public void UpdateCameraManager(ARCameraManager cameraManager)
{
if (_cameraManager == cameraManager)
{
return;
}
if (_cameraManager != null)
{
cameraManager.frameReceived -= OnFrameUpdate;
}
_cameraManager = cameraManager;
if (_cameraManager != null)
{
_cameraManager.frameReceived += OnFrameUpdate;
}
}
public void ResetARCoreSession()
{
if (_sessionHandle != IntPtr.Zero)
{
Debug.Log("Reset cross platform ARCoreSession.");
if (_frameHandle != IntPtr.Zero)
{
FrameApi.ReleaseFrame(_frameHandle);
_frameHandle = IntPtr.Zero;
}
ExternApi.ArSession_destroy(_sessionHandle);
_sessionHandle = IntPtr.Zero;
}
}
public void ResetInstanceAndSession()
{
ResetARCoreSession();
if (_instance != null)
{
_instance = null;
}
}
private void CreateARCoreSession()
{
ResetARCoreSession();
_iosCloudServicesApiKey = RuntimeConfig.Instance == null ?
string.Empty : RuntimeConfig.Instance.IOSCloudServicesApiKey;
Debug.Log("Creating a cross platform ARCore session with IOS Cloud Services API Key:" +
_iosCloudServicesApiKey);
var status = ExternApi.ArSession_create(
_iosCloudServicesApiKey, null, ref _sessionHandle);
if (status != ApiArStatus.Success)
{
Debug.LogErrorFormat("Failed to create a cross platform ARCore session with " +
"error: {0}.", status);
return;
}
}
private void OnFrameUpdate(ARCameraFrameEventArgs frameEventArgs)
{
if (!_isEnabled)
{
return;
}
if (_sessionHandle == IntPtr.Zero)
{
return;
}
if (_frameHandle != IntPtr.Zero)
{
FrameApi.ReleaseFrame(_frameHandle);
_frameHandle = IntPtr.Zero;
}
if (_arKitSession != null && _cameraManager != null && _arKitSession.enabled)
{
var cameraParams = new XRCameraParams
{
zNear = _cameraManager.GetComponent<Camera>().nearClipPlane,
zFar = _cameraManager.GetComponent<Camera>().farClipPlane,
screenWidth = Screen.width,
screenHeight = Screen.height,
screenOrientation = Screen.orientation
};
if (!_cameraManager.subsystem.TryGetLatestFrame(
cameraParams, out XRCameraFrame frame))
{
Debug.LogWarning("XRCamera's latest frame is not available now.");
return;
}
if (frame.timestampNs == 0 || frame.FrameHandle() == IntPtr.Zero)
{
Debug.LogWarning("ARKit Plugin Frame is not ready.");
return;
}
var status = ExternApi.ArSession_updateAndAcquireArFrame(
_sessionHandle, frame.FrameHandle(), ref _frameHandle);
if (status != ApiArStatus.Success)
{
Debug.LogErrorFormat("Failed to update and acquire ARFrame with error: " +
"{0}", status);
return;
}
// Update session configuration.
if (ARCoreExtensions._instance.ARCoreExtensionsConfig != null &&
!ARCoreExtensions._instance.ARCoreExtensionsConfig.Equals(_cachedConfig))
{
_cachedConfig = ScriptableObject.CreateInstance<ARCoreExtensionsConfig>();
_cachedConfig.CopyFrom(ARCoreExtensions._instance.ARCoreExtensionsConfig);
ConfigApi.ConfigureSession(_sessionHandle, _cachedConfig);
}
}
}
private struct ExternApi
{
[IOSImport(ApiConstants.ARCoreNativeApi)]
public static extern ApiArStatus ArSession_create(
string apiKey, string bundleIdentifier, ref IntPtr sessionHandle);
[IOSImport(ApiConstants.ARCoreNativeApi)]
public static extern ApiArStatus ArSession_updateAndAcquireArFrame(
IntPtr sessionHandle, IntPtr arkitFrameHandle, ref IntPtr arFrame);
[DllImport(ApiConstants.ARCoreNativeApi)]
public static extern void ArSession_destroy(IntPtr session);
}
}
} `
Do you get the same errors when building the Geospatial Sample?
I get this exact problem both in my own project and when building the Geospatial example.