In my app, the following workaround seems to work with UaaL on iOS devices.
Please note that I don’t fully understand all the details, so use this at your own risk.
1. Disable plugin registration in RegisterPlugin.mm
// Runtime/Plugins/iOS/RegisterPlugin.mm
-(void)applicationDidFinishLaunching:(NSNotification*) notification
{
NSLog(@"[Override_iOS applicationDidFinishLaunching:%@]", notification);
// Do not register here.
// UnityRegisterRenderingPluginV5(&UnityPluginLoad, &UnityPluginUnload);
}
@end
2. Add plugin loading function to LightshipARDK.m called from Unity.
// Runtime/Plugins/iOS/LightshipARDK.m
void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API LightshipARDK_LoadPluginFromUnity()
{
NSLog(@"LightshipARDK_LoadPluginFromUnity");
UnityRegisterRenderingPluginV5(&UnityPluginLoad, &UnityPluginUnload);
}
@interface LightshipARDK : NSObject
+ (void)loadPlugin;
...
3. Call LightshipARDK_LoadPluginFromUnity from Unity
Add LoadPluginFromUnity
// Runtime/Core/LightshipUnityContext.cs
public class LightshipUnityContext
{
[DllImport("__Internal", EntryPoint = "LightshipARDK_LoadPluginFromUnity")]
public static extern void LoadPluginFromUnity();
and call it from Initialize method.
internal static void Initialize(bool isDeviceLidarSupported, bool disableTelemetry = false, string featureFlagFilePath = "")
{
#if NIANTIC_LIGHTSHIP_AR_LOADER_ENABLED
// load plugin on initialize
Debug.Log("LoadPluginFromUnity start")
LoadPluginFromUnity();
Debug.Log("LoadPluginFromUnity end")