Hello, My problem is that I would like to have the first screen (the screen right before entering AR) removed from the AR Quick look. I want it to where when I open the USDZ, it goes straight into AR, and not show the screen before it, similar to how Apple does it when you want to view their iPhone 13 pro in AR.
Replies
Can you provide a screenshot of this "first screen"? I'm not sure exactly what you mean, afaict, the behavior of the following is that the QLPreviewController will open "straight into AR":
class ViewController: UIViewController {
let url = Bundle.main.url(forResource: "pie", withExtension: "usdz")!
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
presentQuickLook()
}
func presentQuickLook() {
let controller = QLPreviewController()
controller.delegate = self
controller.dataSource = self
present(controller, animated: true)
}
}
extension ViewController: QLPreviewControllerDelegate, QLPreviewControllerDataSource {
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
1
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
ARQuickLookPreviewItem(fileAt: url)
}
}
Hey, This is the screen example I am referring to:
Here you would tap and then it would bring you into the AR experience for this model. I am trying to make it so that when I Open AR, It goes straight into the Augmented reality experience, and not this screen. And pressing the "X" button takes you back to the initial app.
I am using Unity to do this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ARModels : MonoBehaviour
{
public string iOSARLink = "AR.usdz";
// Start is called before the first frame update
public void OpenARModels()
{
Application.OpenURL(iOSARLink);
}
}
Hello,
I'm not completely sure because the screenshot you posted is cut off a bit, but it looks to me like this is what would be displayed if you opened a remote usdz URL using SFSafariViewController for example.
I don't have any insight into what Unity is doing in their api, so I recommend that you reach out to them for further help with that, but as noted previously, the behavior you are looking for is possible natively through direct use of QLPreviewController.