Unable to run a project on visionOS Simulator with a native Unity target

Hi Visioners,

I am trying to move an existing iOS/macOS/tvOS app to the visionOS natively. The game installs properly on Simulator but the error occurs when trying to launch it. First I list tech stack and then Xcode logs. The idea is to run it without any XR/AR-specific interactions like gestures/tracking. Just to make the most basic game native port without running and iOS version there.

  • Mac (M2) with macOS 13.6.1;
  • Unity 2022.3.12f1 Silicon;
  • Xcode 15.1.0 Beta with visionOS Simulator 1.0 Beta 4;
  • Installed packages:
{
  "dependencies": {
    "com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
    "com.unity.ai.navigation": "1.1.5",
    "com.unity.collab-proxy": "2.2.0",
    "com.unity.feature.2d": "2.0.0",
    "com.unity.ide.rider": "3.0.26",
    "com.unity.ide.visualstudio": "2.0.22",
    "com.unity.ide.vscode": "1.2.5",
    "com.unity.memoryprofiler": "1.0.0",
    "com.unity.mobile.notifications": "2.3.0",
    "com.unity.nuget.newtonsoft-json": "3.2.1",
    "com.unity.polyspatial.visionos": "0.4.3",
    "com.unity.polyspatial.xr": "0.4.3",
    "com.unity.recorder": "4.0.1",
    "com.unity.render-pipelines.universal": "14.0.9",
    "com.unity.test-framework": "1.1.33",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.7.6",
    "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.6",
    "com.unity.ugui": "1.0.0",
    "com.unity.xr.arkit": "5.1.0",
    "com.unity.xr.hands": "1.3.0",
    "com.unity.xr.interaction.toolkit": "2.5.2",
    "com.unity.xr.management": "4.4.0",
    "com.unity.xr.visionos": "0.4.3",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}

I previously had an issue with building in Xcode with Unity 2022.3.11f1 described here: https://discussions.unity.com/t/build-fails-when-set-to-full-immersive/304741/7 but updating the Editor solved the issue without a need to remove PolySpatial plugins as libs are now linked correctly in Xcode:


Build and upload for TestFlight builds well but I am unable to test it due to the lack of a physical device so I try a Run option in Xcode for the Simulator. Here’s the output:

CustomComponent of type InstanceRef does not conform to Codable. Component state network sync disabled.
CustomComponent of type RenderInfo does not conform to Codable. Component state network sync disabled.
CustomComponent of type UnityVideoPlayer does not conform to Codable. Component state network sync disabled.
No persisted cache on this platform.
Could not locate file 'default-binaryarchive.metallib' in bundle.
IOSurface connected
Class for component AccessibilityComponent already registered
Class for component ImageBasedLightComponent already registered
Component Shadow already registered
Component Shadow already registered
[USDImportService] RealityIO USDImportService instantiated.  RealityIO will be used to service load requests from USDImportService.
CustomComponent of type UnitySkeletonData does not conform to Codable. Component state network sync disabled.
CustomComponent of type UnityBoneComponent does not conform to Codable. Component state network sync disabled.
CustomComponent of type UnityParticleSystem does not conform to Codable. Component state network sync disabled.
Built from '2022.3/release' branch, Version '2022.3.12f1 (4fe6e059c7ef)', Build type 'Development', Scripting Backend 'il2cpp'
MemoryManager: Using 'Default' Allocator.
[UnityMemory] Configuration Parameters - Can be set up in boot.config
    "memorysetup-allocator-temp-initial-block-size-main=262144"
    "memorysetup-allocator-temp-initial-block-size-worker=262144"
    "memorysetup-bucket-allocator-granularity=16"
    "memorysetup-bucket-allocator-bucket-count=8"
    "memorysetup-bucket-allocator-block-size=4194304"
    "memorysetup-bucket-allocator-block-count=1"
    "memorysetup-main-allocator-block-size=16777216"
    "memorysetup-thread-allocator-block-size=16777216"
    "memorysetup-gfx-main-allocator-block-size=16777216"
    "memorysetup-gfx-thread-allocator-block-size=16777216"
    "memorysetup-cache-allocator-block-size=4194304"
    "memorysetup-typetree-allocator-block-size=2097152"
    "memorysetup-profiler-bucket-allocator-granularity=16"
    "memorysetup-profiler-bucket-allocator-bucket-count=8"
    "memorysetup-profiler-bucket-allocator-block-size=4194304"
    "memorysetup-profiler-bucket-allocator-block-count=1"
    "memorysetup-profiler-allocator-block-size=16777216"
    "memorysetup-profiler-editor-allocator-block-size=1048576"
    "memorysetup-temp-allocator-size-main=4194304"
    "memorysetup-job-temp-allocator-block-size=2097152"
    "memorysetup-job-temp-allocator-block-size-background=1048576"
    "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
    "memorysetup-temp-allocator-size-audio-worker=65536"
    "memorysetup-temp-allocator-size-preload-manager=262144"
    "memorysetup-temp-allocator-size-background-worker=32768"
    "memorysetup-temp-allocator-size-job-worker=262144"
    "memorysetup-temp-allocator-size-gfx=262144"
    "memorysetup-temp-allocator-size-cloud-worker=32768"
    "memorysetup-temp-allocator-size-nav-mesh-worker=65536"
-> applicationDidFinishLaunching()
Found 2 interfaces on host : 0) 10.30.0.112 1) 172.24.161.87
Multi-casting "[IP] 10.30.0.112 [Port] 55000 [Flags] 2 [Guid] 3671430876 [EditorId] 3004563079 [Version] 1048832 [Id] VisionOSPlayer(50,MacBook-Pro.local):56000 [Debug] 0 [PackageName] VisionOSPlayer [ProjectName] KingdomsMergeBuild" to [225.0.0.222:54997]...
[Physics::Module] Initialized MultithreadedJobDispatcher with 7 workers.
Loading player data from /Users/maniak_xcode/Library/Developer/CoreSimulator/Devices/EBEB9E5B-8884-4667-9093-DEF86D9A19CF/data/Containers/Bundle/Application/31A19884-FACD-420E-B0AC-851C09C0EFAD/KingdomsMergeBuild.app/Data/data.unity3d
[Subsystems] Discovering subsystems at path /Users/maniak_xcode/Library/Developer/CoreSimulator/Devices/EBEB9E5B-8884-4667-9093-DEF86D9A19CF/data/Containers/Bundle/Application/31A19884-FACD-420E-B0AC-851C09C0EFAD/KingdomsMergeBuild.app/Data/UnitySubsystems
[Subsystems] No descriptors matched for  examples in UnitySubsystems/UnityVisionOS/UnitySubsystemsManifest.json.
[Subsystems] 1 'inputs' descriptors matched in UnitySubsystems/UnityVisionOS/UnitySubsystemsManifest.json
[Subsystems] 1 'displays' descriptors matched in UnitySubsystems/UnityVisionOS/UnitySubsystemsManifest.json
[Subsystems] 1 'meshings' descriptors matched in UnitySubsystems/UnityVisionOS/UnitySubsystemsManifest.json
GfxDevice: creating device client; threaded=0; jobified=0
Initializing Metal device caps: Apple xrOS simulator GPU
-[MTLSimDevice newHeapWithDescriptor:], line 1153: error 'MTLStorageModePrivate is required for heaps'
-[MTLSimDevice newHeapWithDescriptor:]:1153: failed assertion `MTLStorageModePrivate is required for heaps'
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x0000000105130fe8 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x000000010562312c libsystem_pthread.dylib`pthread_kill + 256
    frame #2: 0x000000018016363c libsystem_c.dylib`abort + 104
    frame #3: 0x0000000180162a94 libsystem_c.dylib`__assert_rtn + 268
    frame #4: 0x000000019ba0b37c Metal`MTLReportFailure.cold.1 + 44
    frame #5: 0x000000019b9e82cc Metal`MTLReportFailure + 436
    frame #6: 0x00000001d421189c MTLSimDriver`-[MTLSimDevice newHeapWithDescriptor:] + 376
  * frame #7: 0x000000011bb001e0 UnityFramework`CreateHeap at MetalHeap.mm:174:24 [opt]
    frame #8: 0x000000011bb00394 UnityFramework`CreateBuffer at MetalHeap.mm:215:16 [opt]
    frame #9: 0x000000011bad86e4 UnityFramework`AllocNewVersionedBuffer at BuffersMetal.mm:64:35 [opt]
    frame #10: 0x000000011bad8988 UnityFramework`Initialize at BuffersMetal.mm:150:43 [opt]
    frame #11: 0x000000011bae6890 UnityFramework`InitializeBufferInternal at GfxDeviceMetal.mm:3492:17 [opt]
    frame #12: 0x000000011b8fdac8 UnityFramework`::CreateDefaultVertexBuffer() [inlined] CreateBuffer at GfxDevice.cpp:726:5 [opt]
    frame #13: 0x000000011b8fda80 UnityFramework`::CreateDefaultVertexBuffer() [inlined] CreateBuffer at GfxDevice.h:585:16 [opt]
    frame #14: 0x000000011b8fda6c UnityFramework`::CreateDefaultVertexBuffer() at GfxDevice.cpp:826:12 [opt]
    frame #15: 0x000000011b8fd838 UnityFramework`::CreateDefaultVertexBuffers() at GfxDevice.cpp:758:40 [opt]
    frame #16: 0x000000011bae5038 UnityFramework`GfxDeviceMetal at GfxDeviceMetal.mm:2982:5 [opt]
    frame #17: 0x000000011bae3e34 UnityFramework`CreateMetalGfxDevice [inlined] GfxDeviceMetal at GfxDeviceMetal.mm:2912:1 [opt]
    frame #18: 0x000000011bae3e28 UnityFramework`CreateMetalGfxDevice at GfxDeviceMetal.mm:2213:30 [opt]
    frame #19: 0x000000011b901a4c UnityFramework`::CreateRealGfxDevice() at GfxDeviceSetup.cpp:256:16 [opt]
    frame #20: 0x000000011b49404c UnityFramework`::CreateClientGfxDevice() at GfxDeviceClient.cpp:116:73 [opt]
    frame #21: 0x000000011b9021b0 UnityFramework`::CreateGfxDevice() at GfxDeviceSetup.cpp:610:25 [opt]
    frame #22: 0x000000011b90222c UnityFramework`::InitializeGfxDevice() at GfxDeviceSetup.cpp:799:18 [opt]
    frame #23: 0x000000011bacf678 UnityFramework`UnityInitApplicationGraphics at LibEntryPoint.mm:201:5 [opt]
    frame #24: 0x000000011b06dc54 UnityFramework`-[UnityAppController startUnity:](self=0x00006000021ac280, _cmd="startUnity:", application=<unavailable>) at UnityAppController.mm:118:5 [opt]
    frame #25: 0x000000011b06e3f4 UnityFramework`-[UnityAppController application:didFinishLaunchingWithOptions:](self=0x00006000021ac280, _cmd=<unavailable>, application=<unavailable>, launchOptions=<unavailable>) at UnityAppController.mm:343:5 [opt]
    frame #26: 0x000000011b071b40 UnityFramework`-[UnityFramework runEmbeddedWithArgc:argv:appLaunchOpts:](self=0x0000600000004230, _cmd=<unavailable>, argc=<unavailable>, argv=<unavailable>, appLaunchOpts=<unavailable>) at main.mm:120:9 [opt]
    frame #27: 0x0000000104caaf84 KingdomsMergeBuild`specialized UnityPolySpatialAppDelegate.application(self=<unavailable>) at UnityPolySpatialAppDelegate.swift:93:15 [opt]
    frame #28: 0x0000000104ca9ebc KingdomsMergeBuild`@objc UnityPolySpatialAppDelegate.application(_:didFinishLaunchingWithOptions:) [inlined] KingdomsMergeBuild.UnityPolySpatialAppDelegate.application(_: __C.UIApplication, didFinishLaunchingWithOptions: Swift.Optional<Swift.Dictionary<__C.UIApplicationLaunchOptionsKey, Any>>) -> Swift.Bool at <compiler-generated>:0 [opt]
    frame #29: 0x0000000104ca9eb8 KingdomsMergeBuild`@objc UnityPolySpatialAppDelegate.application(_:didFinishLaunchingWithOptions:) at <compiler-generated>:89:10 [opt]
    frame #30: 0x00000001c67b9738 SwiftUI`___lldb_unnamed_symbol155470 + 192
    frame #31: 0x00000001c67b97e8 SwiftUI`___lldb_unnamed_symbol155471 + 136
    frame #32: 0x00000001852f66b8 UIKitCore`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 312
    frame #33: 0x00000001852f7b30 UIKitCore`-[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 2788
    frame #34: 0x00000001852fc608 UIKitCore`-[UIApplication _runWithMainScene:transitionContext:completion:] + 856
    frame #35: 0x000000018498c4cc UIKitCore`-[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 148
    frame #36: 0x00000001852f98fc UIKitCore`-[UIApplication _compellApplicationLaunchToCompleteUnconditionally] + 44
    frame #37: 0x00000001852f9c4c UIKitCore`-[UIApplication _run] + 832
    frame #38: 0x00000001852fd910 UIKitCore`UIApplicationMain + 124
    frame #39: 0x00000001c7066808 SwiftUI`___lldb_unnamed_symbol224375 + 172
    frame #40: 0x00000001c7066698 SwiftUI`___lldb_unnamed_symbol224373 + 140
    frame #41: 0x00000001c6cfe3e8 SwiftUI`static SwiftUI.App.main() -> () + 96
    frame #42: 0x0000000104cac530 KingdomsMergeBuild`main [inlined] static KingdomsMergeBuild.UnityPolySpatialApp.$main(self=KingdomsMergeBuild.UnityPolySpatialApp) -> () at UnityPolySpatialApp.swift:0 [opt]
    frame #43: 0x0000000104cac4fc KingdomsMergeBuild`main at UnityPolySpatialApp.swift:0 [opt]
    frame #44: 0x0000000105195544 dyld_sim`start_sim + 20
    frame #45: 0x0000000104f75f28 dyld`start + 2236

The most interesting things out there in my opinion are:

Could not locate file 'default-binaryarchive.metallib' in bundle.
[...]
-[MTLSimDevice newHeapWithDescriptor:], line 1153: error 'MTLStorageModePrivate is required for heaps'
-[MTLSimDevice newHeapWithDescriptor:]:1153: failed assertion `MTLStorageModePrivate is required for heaps'

It seems like an error with a rendering initialisation. I will be glad for any kind of help.

Thanks
Maniak

Hey there! Sorry to hear you’re having trouble. I took a look at your log output but nothing jumps out at me as something wrong. You don’t actually need the ARKit package unless you intend to build without PolySpatial for iOS. Similarly, unless you need to use AR features, you don’t need to enable the visionOS loader.

Are you able to submit a bug report with the project attached? If not, could you create a new project that replicates the issue and send a download link? Short of that–is there anything in your project aside from the packages in the attached manifest?

Hi @mtschoen

Currently we use some of Apple plugins for Unity:

  • Core 1.0.3;
  • CoreHaptics 1.0.2;
  • GameController 1.0.2;
  • GameKit 1.0.4;

Also Apple Arcade plugins:

  • CloudKit 1.0.1;
  • CloudSaves 1.0.0;

They are basically adapted by copying iOS Plugins and Wrappers as they are arch-wise siblings with visionOS and tvOS due to the arm64 architecture. We don’t need to include all of them at the moment to get a basic gameplay experience. However logs say that the problem is a rendering issue.

Also removing

"com.unity.xr.arkit": "5.1.0",
"com.unity.xr.visionos": "0.4.3"

and upgrading Xcode to 15.1 Beta 2 and macOS to 14.1 does not solve the issue.

Thanks
MM

Can you past the specific log you are seeing? Is the issue happening at build time or when you run the app?

Were you able to submit a bug report with a repro project?

worth checking - you wouldn’t happen to have “show splash screen” checked? A surprising amount of “no rendering” issues is traced back to that and unfortunately this failure doesn’t output any useful errors.

The issue happens during the “Run” phase in Xcode in the visionOS Simulator. The app installs and the icon is visible in the Simulator then it crashes. The full Xcode logs are pasted above. Or do you want logs from non-PolySpatial plugin build?

I have Unity splash screen disabled.

My mistake. I forgot this was the same issue that I replied to before. I wasn’t able to reproduce the issue with the package manifest/instructions included above. Can you submit a bug report or link to a project zip that we can download to reproduce the issue?

Hi,

I was having the exact same stacktrace with equal packages and Unity version. After trying to upgrade the polyspatial packages to 0.5 I noticed that I was building in Unity for the Device SDK whilst also building in XCode for a simulator.
Changing the SDK in the player settings to Simulator fixed the crash for my project, maybe it helps you as well.

Screen Shot 2023-11-10 at 11.07.02 AM

Best regards

Hi @SAPHNoll

Hopefully it solved the issue :slight_smile:
@mtschoen there is no need to send a repro repo now as this thread can be closed.

The difference was that I was building with Device SDK in Unity which forced xros platform in Xcode’s Build Settings. Changing it manually to visionOS which I did every time implicitly set it to xros xrsimulator. Selecting Simulator SDK in Unity sets it explicitly to xrsimulator and solves the issue.

Thanks again @SAPHNoll

MM

1 Like