Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Feature Request Running Unity game on new VisionOS simulator

Discussion in 'iOS and tvOS' started by sergioabril, Jun 22, 2023.

Thread Status:
Not open for further replies.
  1. sergioabril

    sergioabril

    Joined:
    Jan 11, 2016
    Posts:
    33
    I was expecting to be able to run a Unity build (as a framework) on the new Apple's Vision Pro simulator, released yesterday. After all, Apple says it's able to run iOS Apps, it's based on iOS, and I'm running the same iOS target (not a new one). I was hoping somehow that the Unity framework would be compatible as well. But I guess it's not, at least I did not figure it out.

    My question is, will a new Unity release include the option to add "Vision Pro" as a target device, within the iOS SDK target, just like it happens with iPad, when building for iOS? Something like iPhone+iPad+VisionPro below:


    I know Vision Pro uses a different SDK, but Xcode somehow allows you to add it as a destination device within the same iOS target, no needing a new one:


    It would be convenient to build "universal" binaries (if it's even possible). Otherwise I guess I would need to create different targets for different platforms, and build the Unity framework twice for the same Xcode project?

    But then again, I don't even know what I'm saying, and I'm not sure if it even makes sense. Maybe I'm missing something, and it needs to be done in a different way.
    Just wondering if anyone has any knowledge on this.
    Thanks!

    note: I'm not trying to run the Xcode project that Unity generates. Instead, I have it added as a framework to a workspace, because I need native code on top of it, and I reference it as a framework to present the game when I need to. Just in case it's relevant.
     
    Last edited: Jun 22, 2023
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,988
    I'm also trying to see if our game works okay on the Vision Pro simulator (as per Apple's instructions), in the "designed for iPad" mode, but I guess it's not possible?

    Am I missing some step, or is it simply impossible to do using Unity 2021?
     
  3. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,628
    this is convoluted for now (i know, i know) what worked for me:
    1. in new xcode they are moving away from x64 simulators (we are working on arm64 simulator libs), so first of all you would need to enable rosetta simulator targets:
    Product > Destination > Destination Architectures > Show Rosetta Destinations
    2. in build settings for app you need to tweak supported platforms to have visionOS (didnt work for me with "Any Target" for some reason)
    3. i did build and run and it failed to run for some reason (no matter what i try) - but it did install app on simulator and i could run from here directly (alas, atttaching debugger does not work)
    while this is quite convoluted setup - this works for now (we are working on making all this better)
     
    efge, aihodge and AcidArrow like this.
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,988
    Thanks for the tips, I have to admit I didn't think the simulator would still need rosetta.

    But I'm giving up. I can't even get the normal iOS simulators work with our game (while empty projects do work), so I'm guessing there's an even slimmer chance of the VisionOS simulator working.

    In general in the last 10 years our game has only sporadically played well with the iOS simulators, I guess this isn't one of those times. Which is a bit of a bummer, since I would have liked to submit our game to be considered as "playing well with VisionOS", but I guess I can't do that.
     
  5. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,628
    > In general in the last 10 years our game has only sporadically played well with the iOS simulators
    hm that's weird - lately simulators were quite stable for me. But yeah - the situation with rosetta is painful - we are working on resolving this no worries
     
  6. AndreusNvidius

    AndreusNvidius

    Joined:
    May 17, 2022
    Posts:
    3
    I'm currently having an issue with the visionOS (yes, I know, experimental) support in 2022.3.5f1.

    I'm trying to run an exported app on the VisionOS simulator, but getting this error in Xcode:
    Building for 'xrOS-simulator', but linking in object file ( <<<snipped>>> Libraries/libiPhone-lib.a[5](MeshSkinningNEON64_blzfc.o)) built for 'xrOS'


    If, on the other hand, I try to export an app by selecting
    Project Settings > Player > Other Settings > Configuration > Target SDK
    to "Simulator SDK", I get this error in the Unity Editor (i.e., it doesn't make it to Xcode):

    Building xrsimulator_build/Libraries/libiPhone-lib.dylib failed with output:
    The source path /Applications/Unity/Hub/Editor/2022.3.5f1/PlaybackEngines/VisionOSPlayer/Trampoline/Libraries/libiPhone-lib-amd64-il2cpp.dylib does not exist.
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

    Building xrsimulator_build/Libraries/libil2cpp.a failed with output:
    The source path /Applications/Unity/Hub/Editor/2022.3.5f1/PlaybackEngines/VisionOSPlayer/Trampoline/Libraries/libil2cpp-amd64-net40.a does not exist.
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

    Building xrsimulator_build/Libraries/baselib.a failed with output:
    The source path /Applications/Unity/Hub/Editor/2022.3.5f1/PlaybackEngines/VisionOSPlayer/Trampoline/Libraries/baselib-amd64.a does not exist.
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

    BuildFailedException: Player build failed: 3 errors
    UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/BeeBuildPostprocessor.cs:718)
    UnityEditor.VisionOS.VisionOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <0c1edcfdb4884c8281b11eb78f3ba24d>:0)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

    Build completed with a result of 'Failed' in 11 seconds (11148 ms)
    4 errors
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)


    I'm on an M1 mac mini, XCode 15 beta 4, Unity 2022.3.5f1.

    I know this is super early days but I could really use a flow from Unity into the Vision Pro Simulator.
     
    bamboounity and drunknbass_ like this.
  7. phak9402

    phak9402

    Joined:
    Jul 30, 2023
    Posts:
    1
    I also have same problem. First, when build, warn with " 'TARGET_OS_XR' is not defined " and I change TARGET_OS_XR to TARGET_OS_VISION. But now I have same error
    " Building for 'xrOS-simulator', but linking in object file ~~ built for 'xrOS' "
    error. Rossetta doesn't work. And if I change Target SDK to "Simulator SDK" then xcode build failed.
    I run with xcode 15.5 beta and visionOS 1 beta 2 Simulator Runtime. M1 and Unity 2022.3.5f1.
     
    samuelmorais likes this.
  8. jessekirbs

    jessekirbs

    Joined:
    Apr 4, 2014
    Posts:
    18
    I'm experiencing the same issue as Andreus and phak. Please give us some guidance here because we're trying to submit our app for the Vision Pro summit and there is no detailed info on how to do this. The WWDC videos just say 'Set the Build Target' and 'Select the XR Plugin'. Couldn't be more vague.
     
  9. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    62
  10. pretzelmonster

    pretzelmonster

    Joined:
    May 23, 2022
    Posts:
    2
    Same issue here. I guess that's the official end of the approach at the moment...
    Hopefully a new version will fix this.
     
  11. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,104
    @Unity could you get a hurry on on this?

    And some kind of way of testing custom shaders, from Builtin, fast, please.

    And focus on not needing URP, as that thing is nowhere near ready for primetime, despite all the claims.
     
  12. v_vuk

    v_vuk

    Unity Technologies

    Joined:
    Jul 11, 2017
    Posts:
    36
    Hi all -- we're working on getting a visionOS specific forum for discussing the base platform support (for windowed/slate mode). For now, in order to build with the base visionOS platform, you need Xcode 15 beta 2 (lots of things are changing very quickly in the betas, i.e. OS define names!), and Apple Silicon machines. We hope to have both issues resolved very soon.
     
    aihodge likes this.
  13. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    unfortunately this doesn't seem to work well for me - I get the same error messages "lib-amd64-il2cpp.dylib" etc, when building for the simulator, using a M1 Mac. Is there a something we're missing?
     
  14. Ajaydharan

    Ajaydharan

    Joined:
    May 16, 2017
    Posts:
    7
    Hi @v_vuk
    Does it mean we cannot work on Intel based Mac machines for the Unity projects to develop VisionOS apps?
     
    waldgeist likes this.
  15. pretzelmonster

    pretzelmonster

    Joined:
    May 23, 2022
    Posts:
    2
    Thanks for the 'official' response!
    Ok, now that I read this post again as use Xcode 15 Beta 2 exactly on a M1/2 machine, I really got rid of the link error (I used Beta 5 before). Now I get a valid app in the Simulator (but it doesn't work properly yet...).
    Thanks for this, now we are one step further!
     
    Last edited: Aug 4, 2023
  16. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    How do you get past the missing libraries?
    When I build for simulator on an M1 machine I get the following build errors :

    Code (CSharp):
    1.  
    2. /Applications/Unity/Hub/Editor/2022.3.6f1/PlaybackEngines/VisionOSPlayer/Trampoline/Libraries/baselib-amd64.a does not exist.
    3. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)
    4.  
    5. Building /Users/frogameleon/Desktop/Visions/Libraries/libil2cpp.a failed with output:
    6. The source path /Applications/Unity/Hub/Editor/2022.3.6f1/PlaybackEngines/VisionOSPlayer/Trampoline/Libraries/libil2cpp-amd64-net40-wbarriers.a does not exist
    7.  
    8. /Applications/Unity/Hub/Editor/2022.3.6f1/PlaybackEngines/VisionOSPlayer/Trampoline/Libraries/libiPhone-lib-amd64-il2cpp.dylib does not exist.
     
  17. trigger-james

    trigger-james

    Joined:
    Aug 14, 2019
    Posts:
    8
    Probably not the best solution but you can find these libraries in the iOS Platform Playback Engines. I copied them over to the Vision Pro platform directory and it certainly got me a little further. I can install a build on the simulator in Xcode but it crashes on launch.
     
  18. drunknbass_

    drunknbass_

    Joined:
    Apr 8, 2013
    Posts:
    5
    I have a native project building and bundling Unity as a framework and loading it via a SwiftUI view in immersive mode, but upon loading the Unity player view I get a crash (metal buffer). When running the unity framework as a stand alone build on visionOS via the windowed app it runs.
    I would love to know what the missing link is to get the hybrid rendering modes to work. It seems like we would need to provide a rendering context FROM native to unity to allow these modes?

    This is how the visionOS UE5 changes look fwiw.

    upload_2023-8-10_10-25-54.png
     
  19. Priva28

    Priva28

    Joined:
    Mar 22, 2023
    Posts:
    3
    Hey @drunknbass_, we are also using Unity as a framework but are struggling to get it built for the visionOS simulator at all, seeing missing library and other ambiguous errors. Would you mind providing a few steps or info on how you got this running?
     
    Unifikation likes this.
  20. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    How does this work on an Intel Mac? Xcode does not find the Vision Pro simulator as a target here.
     
  21. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    Does this mean I would need to buy a new Mac?! Or is this only temporarily?
     
  22. drunknbass_

    drunknbass_

    Joined:
    Apr 8, 2013
    Posts:
    5
    What I have is mostly similar to what is here
    https://github.com/DavidPeicho/unity-swiftui-example

    w
    ith some minor modifications for my project(iOS/tvOS/visionOS game). You also need to use Xcode beta v2 which appears to have a broken URL in the apple downloads portal so I included it here to help.
    https://download.developer.apple.com/Developer_Tools/Xcode_15_beta_2/Xcode_15_beta_2.xip
     
  23. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
  24. fla-rar

    fla-rar

    Joined:
    May 1, 2014
    Posts:
    246
    I imagine that if we do not qualify by filling out this form, no matter how good we are,
    the same, we can build our apps and games, for Apple Vision pro because, at the time, they will open the doors for everyone, right?
    And will everyone be able to program in unity and export to xcode and likewise to vision pro glasses?
    TRUE ?
     
  25. fcascinelli

    fcascinelli

    Joined:
    Aug 12, 2017
    Posts:
    7
    hello,

    i just updated to beta 6, but still have couple of missing libs.
    any luck on your side?


    fc
     
  26. Joaqo

    Joaqo

    Joined:
    May 30, 2016
    Posts:
    2

    Were you able to resolve the metal issue? So the metal issue only appears for immersive and not window level? I might be getting the same error:
    Code (CSharp):
    1. -[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5780: failed assertion `Draw Errors Validation
    2. Vertex Function(xlatMtlMain): the offset into the buffer VGlobals that is bound at buffer index 0 must be a multiple of 256 but was set to 192.


    For context, I have xcode 15 beta 2, unity 2022.3.5f1, and inject the AppDelegate like follows. But I only attempt the embedding at window level (no immersive):

    Code (Swift):
    1. import SwiftUI
    2.  
    3.  
    4. // no changes in your AppDelegate class
    5. class AppDelegate: NSObject, UIApplicationDelegate {
    6.     var window: UIWindow?
    7.     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    8.         print("App delegate!!!")
    9.         Unity.shared.setHostMainWindow(window)
    10.         return true
    11.     }
    12. }
    13.  
    14.  
    15. @main
    16. struct VisionHostApp: App {
    17.     @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    18.    
    19.     var body: some Scene {
    20.         WindowGroup {
    21.             ContentView()
    22.         }
    23.     }
    24. }
    25.  
     
  27. Joaqo

    Joaqo

    Joined:
    May 30, 2016
    Posts:
    2
    Also related, have you been able to run a unity-embedding in a region of the window as opposed to unity taking control over the whole screen?
    (just checking because I know the docs say it's not possible)
     
  28. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    Are there any updates on this? I still can't run my app on visionOS simulator, although I've exported it to visionOS as a target platform.
     
  29. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,104
    Kind of. Epic is working on a VisionOS feature for Unreal engine. It's on GitHub and probably already works.

    This might cause Unity to get it working.
     
    waldgeist likes this.
  30. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    Sounds interesting. Does it also support immersive AR or is it for VR only? We are building AR apps.
     
Thread Status:
Not open for further replies.