void InitializeARKit(serializableARKitInit sai) { #if !UNITY_EDITOR //get the config and runoption from editor and use them to initialize arkit on device //added Sascha Gehlich's modifications to this method bc this seemed to help with the framerate issues Application.targetFrameRate = 60; m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface(); ARKitWorldTrackingSessionConfiguration config = sai.config; UnityARSessionRunOption runOptions = sai.runOption; UnityARSessionNativeInterface session = UnityARSessionNativeInterface.GetARSessionNativeInterface(); config.planeDetection = UnityARPlaneDetection.Horizontal; var videoFormat = UnityARVideoFormat.SupportedVideoFormats()[UnityARVideoFormat.SupportedVideoFormats().Count - 1]; config.videoFormat = videoFormat.videoFormatPtr; Application.targetFrameRate = videoFormat.framesPerSecond; m_session.RunWithConfigAndOptions(config, runOptions); UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; UnityARSessionNativeInterface.ARAnchorAddedEvent += ARAnchorAdded; UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated; UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved; #endif }
void InitializeARKit(serializableARKitInit sai) { #if !UNITY_EDITOR //get the config and runoption from editor and use them to initialize arkit on device Application.targetFrameRate = 60; m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface(); ARKitWorldTrackingSessionConfiguration config = sai.config; UnityARSessionRunOption runOptions = sai.runOption; //potentially improves framerate? //https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/issues/78/remote-very-low-fps-and-repeated UnityARSessionNativeInterface session = UnityARSessionNativeInterface.GetARSessionNativeInterface(); config.planeDetection = UnityARPlaneDetection.Horizontal; var videoFormat = UnityARVideoFormat.SupportedVideoFormats()[UnityARVideoFormat.SupportedVideoFormats().Count - 1]; config.videoFormat = videoFormat.videoFormatPtr; Application.targetFrameRate = videoFormat.framesPerSecond; m_session.RunWithConfigAndOptions(config, runOptions); UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; UnityARSessionNativeInterface.ARAnchorAddedEvent += ARAnchorAdded; UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated; UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved; #endif // #if !UNITY_EDITOR // //get the config and runoption from editor and use them to initialize arkit on device // Application.targetFrameRate = 60; // m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface(); // ARKitWorldTrackingSessionConfiguration config = sai.config; // UnityARSessionRunOption runOptions = sai.runOption; // m_session.RunWithConfigAndOptions(config, runOptions); // UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; // UnityARSessionNativeInterface.ARAnchorAddedEvent += ARAnchorAdded; // UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated; // UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved; // #endif }
private static void AddToVFList(UnityARVideoFormat newFormat) { Debug.Log("New Format returned"); videoFormatsList.Add(newFormat); }