How to Extract Mesh Files on iOS

Include the following details (edit as applicable):

  • Issue category: Semantic Segmentation / Multiplayer / Real-time Mapping-Depth / ARDK Documentation / Unity Example Package / Sample App aka ‘AR Voyage’ / ARDK Virtual Studio Tools / Developer Tools / Networking / VPS
  • Device type & OS version: Android / iOS / Other Ex. iPhone 8+ on iOS 13
  • Host machine & OS version: Mac / Windows / Linux / Other Ex. Mac on Big Sur x.x
  • Issue Environment : Unity Remote / Unity Mock / On Device / Dev Portal
  • Xcode version:
  • ARDK version:
  • Unity version:

Description of the issue:

I have published the scene MeshSavers of ARDK Example to my iPhone.
I read the article " Extract Mesh Files on iOS"
https://lightship.dev/docs/ardk/context_awareness/meshing/meshing_tutorial_unityeditor.html#extract-mesh-files-on-ios
But It doesn’t show the App I published. So I cant extract the mesh file.
Is there other method to extract the file?

Hello Aw1,

Could you please provide the following information so that we may better assist you?

  • Your Device type and OS version
  • Your Host machine and OS version
  • Your ARDK version
  • Your Unity version

Thank you!

Hi, Stacy:
This my information:
Your Device type and OS version, iPhone 12 pro, 15.1.1

  • Your Host machine and OS version, MacOS Monterey 12.2
  • Your ARDK version: 2.0.0
  • Your Unity version: 2020.3.35
    Thank you!

Hello Aw1,

Thank you for your patience while we investigated this issue.

To save and extract meshes on iOS, you need to create a script in your Project tab and name it EnableFileSharingPostProcessor. Then, please open the script and replace the entire default code with the following code:

// Copyright 2021 Niantic, Inc. All Rights Reserved.

#if UNITY_IOS && UNITY_EDITOR

using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System.IO;

public class EnableFileSharingPostProcessor
{
  [PostProcessBuild]
  public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
  {
     if (buildTarget == BuildTarget.iOS)
     BuildForiOS(path);
  }

  private static void BuildForiOS(string path)
  {
     // Get plist
     string plistPath = path + "/Info.plist";
     PlistDocument plist = new PlistDocument();

     plist.ReadFromString(File.ReadAllText(plistPath));

     // Set key and value for UIFileSharingEnabled.
     PlistElementDict rootDict = plist.root;

     rootDict.SetBoolean("UIFileSharingEnabled", true);

     // Write to file
    File.WriteAllText(plistPath, plist.WriteToString());
  }
}

#endif

After saving this script, please rebuild the project to your device and follow the same instructions you did earlier on the Advanced Tutorial: Meshes in the Unity Editor page you linked. With this new script, you will now be able to view your app and extract your saved meshes into your Unity project.

Please let me know if you have any trouble with the above steps or if they do not solve the problem. Thank you!

I got it!
Stacy: Thank you!