/// <summary> /// Unity's OnEnable method. /// </summary> public void OnEnable() { #if UNITY_IOS && ARCORE_EXTENSIONS_IOS_SUPPORT IOSSupportManager.Instance.SetEnabled(true); #endif // UNITY_IOS && ARCORE_EXTENSIONS_IOS_SUPPORT #if UNITY_ANDROID if (_instance.Session == null) { Debug.LogError("ARSession is required by ARCoreExtensions!"); return; } _arCoreSubsystem = (ARCoreSessionSubsystem)Session.subsystem; if (_arCoreSubsystem == null) { Debug.LogError( "No active ARCoreSessionSubsystem is available in this session, Please " + "ensure that a valid loader configuration exists in the XR project settings."); } else { _arCoreSubsystem.beforeSetConfiguration += BeforeConfigurationChanged; } #endif // UNITY_ANDROID CachedData.Reset(); }
/// <summary> /// Unity's OnDisable method. /// </summary> public void OnDisable() { #if UNITY_IOS && ARCORE_EXTENSIONS_IOS_SUPPORT IOSSupportManager.Instance.SetEnabled(false); #endif // UNITY_IOS && ARCORE_EXTENSIONS_IOS_SUPPORT #if UNITY_ANDROID if (_arCoreSubsystem != null) { _arCoreSubsystem.beforeSetConfiguration -= BeforeConfigurationChanged; } #endif // UNITY_ANDROID CachedData.Reset(); }