Search Unity

Native iOS NSKeyedArchiver -> ARWorldMap.TryDeserialize

Discussion in 'AR/VR (XR) Discussion' started by pzhine, Nov 28, 2019.

  1. pzhine

    pzhine

    Joined:
    Mar 6, 2019
    Posts:
    1
    I have developed an iOS/ARKit app that functions as a content editor for my AR game. It has a fair amount of interface that I don't want to port over to Unity, but I want to be able to save my ARWorldMaps from the iOS editor app and load them into my Unity AR game.

    I'm using NSKeyedArchiver to serialize my ARWorldMap like this:

    Code (Swift):
    1.  
    2. func serializeMap(_ worldMap: ARWorldMap) -> Data {
    3.     return try! NSKeyedArchiver.archivedData(
    4.         withRootObject: worldMap,
    5.         requiringSecureCoding: true
    6.     )
    7. }
    8.  
    Any ideas how I could use those bytes returned from `serializeMap` to load the map in Unity using `ARWorldMap.TryDeserialize` in AR Foundation?