Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Mac Standalone Xcode Project generation

Discussion in '2019.3 Beta' started by User340, May 17, 2019.

  1. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Has this feature landed yet in this alpha? I didn't see mention of it in the release notes.
     
    Q-Ted likes this.
  2. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    Yes, please... I'm only waiting for it to test the Alpha! Is there any estimative?
     
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Current estimate is 2019.3.0a5 - a6, so around 2 - 3 weeks from now.
     
    FROS7 and User340 like this.
  4. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Yippee! I absolutely can't wait! This is gonna open up a whole new world of possibilities!
     
  5. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    @LeonhardP would he possible to create plugins without precompiling them? I mean be able to behave like iOS or Android where we can put in Unity .h .mm and .java files and make Unity compile them for us.
     
    Last edited: May 23, 2019
    User340 likes this.
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
  7. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    We should be able to support .m and .mm files if you put them in Unity project. If that doesn't work, mind submitting a bug report?
     
    User340 likes this.
  9. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Bump. a6 is out now, any word if this feature has shipped?
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    It landed to alpha 7 last week. So you should be able to get your hands on it next week.
     
    User340 likes this.
  11. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Thanks for the update.
     
  12. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    It's here in a7!
    • OSX: Unity can now generate Xcode project for macOS standalone build

    First impressions:
    1) When I build it doesn't create a folder. It would be nice if it put all of the contents into a folder automatically.
    2) I don't seem to have access to the source code like it is on iOS. I was hoping that we would have access to more source code this way, just like how on iOS I can modify AppDelegate and stuff like that. @Tautvydas-Zilys Any chance this will be exposed?
     
    Last edited: Jun 26, 2019
    wagenheimer likes this.
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Unity's macOS support doesn't really have the same source code structure as iOS does. What specifically would you like exposed?
     
  14. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Does it have a layer written in Objective C? If so that would be what to expose. I'd like to see the NSWindow class. Also I'd like control over the dark mode and NSMenu visibility.
     
  15. andrar

    andrar

    Joined:
    Sep 27, 2017
    Posts:
    18
    There is an Objective C layer but historically it was not designed to be exposed and customizable. It's a good feedback and we'll think about what can be done. We also considering adding more control over NSMenu but nothing specific yet.
     
    User340 likes this.
  16. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    142
    I was happy to find that Unity 2019.3 was able to generate codesigned XCode projects ready for upload to the Mac App Store, which I thought would have fixed the nightmarish and currently impossible process of uploading correctly packaged apps to the Mac AppStore.

    Unfortunately, it still doesn't seem to work properly.

    When I make a build with the Scripting Backend IL2CPP I get the following error:
    ......
    .app/Contents/Frameworks/GameAssembly.map: No such file or directory

    and when I build with the Scripting Backend Mono I get the following error:

    .app/Contents/Frameworks/MonoBleedingEdge: bundle format unrecognized, invalid, or unsuitable


    Either way, it seems like an insurmountable problem, yet again, to clear this hurdle.

    I have tried innumerable permutations in order to get it codesigned correctly but it always stops at one of these two points.

    Any idea if there will be a way around this block in future updates?
     
  17. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Does this feature mean it would be possible to upload and sign an app using just a windows pc?
     
  18. andrar

    andrar

    Joined:
    Sep 27, 2017
    Posts:
    18
    A mac is still required in order to build the project and codesign executables.
     
  19. andrar

    andrar

    Joined:
    Sep 27, 2017
    Posts:
    18
    Would you mind sharing your build logs? In Xcode go to Report navigator and press Save button in order to export the log. Also some repro steps would be helpful.
     
  20. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    142
    When I build with the IL2CPP, it won't complete the build and I have attached the Report log Below.
    When i build with the Mono Scripting Backend it will successfully build and play it, but it fails on the last codesign upon validation here: (reports also attached)
    }
    2019-07-16 14:14:37 +0000 Writing entitlements for <IDEDistributionItem: 0x7f8ad601b030 'XXXXXX.XXXXX' '<DVTFilePath:0x7f8ad4ef8840:'/Users/XXXXXXXXXLibrary/Developer/Xcode/Archives/2019-07-16/XXXXXXXX16-07-2019, 16.13.xcarchive/Products/Applications/XXXXXXXX.app'>'> to: /var/folders/22/dn5q5z554p91s14y49gqklxw0000gn/T/XcodeDistPipeline.suv/entitlements7F1N81
    2019-07-16 14:14:37 +0000 Running /usr/bin/codesign '-vvv' '--force' '--sign' 'FAB1C0720E4AD302A0B84460E1E5329355BAF35E' '--preserve-metadata=identifier,flags' '--entitlements' '/var/folders/22/dn5q5z554p91s14y49gqklxw0000gn/T/XcodeDistPipeline.suv/entitlements7F1N81' '/var/folders/22/dn5q5z554p91s14y49gqklxw0000gn/T/XcodeDistPipeline.suv/Root/Applications/XXXXXXX.app'
    2019-07-16 14:14:38 +0000 /var/folders/22/dn5q5z554p91s14y49gqklxw0000gn/T/XcodeDistPipeline.suv/Root/Applications/XXXXXXX.app: code object is not signed at all
    In subcomponent: /private/var/folders/22/dn5q5z554p91s14y49gqklxw0000gn/T/XcodeDistPipeline.suv/Root/Applications/XXXXXXXXX.app/Contents/Frameworks/MonoBleedingEdge/etc/mono/config

    2019-07-16 14:14:38 +0000 2019-07-16 14:14:38 +0000

    2019-07-16 14:14:38 +0000 /usr/bin/codesign exited with 1
    2019-07-16 14:14:38 +0000 2019-07-16 14:14:38 +0000

    I tried removing the Unity IAP ( made no difference ). It was originally an IOS project that was converted to Mac build. It used to have GoogleMobileAds which I subsequently removed. Its Linear color space and Auto Api for Mac.
     
  21. andrar

    andrar

    Joined:
    Sep 27, 2017
    Posts:
    18
    Thanks a lot for the report! From the IL2CPP log it seems that some of the files did not make it into the generated xcode project. When building in Unity did you notice any errors in the console? Are you able to build an empty Unity project this way? If it's specific to your game it would be great if you shared your Unity project with us using "Help/Report a bug" tool so we could reproduce the problem on our end.
     
  22. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    142
    Now that you mention it, I did find this error warning on IL2CPP build:

    Error: Could not load signature of UnityEngine.Purchasing.UIFakeStore:GetOkayButton due to: Could not load file or assembly 'UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:<unknown type> member:(null) signature:<none>

    Unity.UI is checked in the package manager...
    When building with Mono this warning does not appear

    I will share the Unity project with you using "Help/Report a bug" tool ASAP

    Also:
    I made an empty project build and was confronted with these errors in xcode ( see attached ) when attempting to archive.
    As with the full project, it fails when attempting to codesign the config file in the MonoBleedingEdge Folder in the Frameworks
     

    Attached Files:

    Last edited: Jul 17, 2019
  23. andrar

    andrar

    Joined:
    Sep 27, 2017
    Posts:
    18
    Seems like there are two separate issues with generated IL2CPP project and codesign in general. We will take a look, thanks for letting us know!
     
  24. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    My app is having problems in fullscreen mode, can't access the doc or menu bar. Please open this stuff up so that I can make my app feel more like a native app.
     
  25. mmortall

    mmortall

    Joined:
    Dec 28, 2010
    Posts:
    89
    Could you provide any documentation on this feature? I see just main.cpp and PlayerMain call. Probably an extern function from UnityPlayer.dylib.
    How can I get windows mode? May be there are more options to control the target render surface of some UIView etc.
    How can I access window Menu?
    It looks like a very low level. Could you assist on this?
    Thanks
     
  26. mmortall

    mmortall

    Joined:
    Dec 28, 2010
    Posts:
    89
    Unity, could you give an update on this topic? Thanks.
     
  27. KevinWelton

    KevinWelton

    Joined:
    Jul 26, 2018
    Posts:
    239
    We currently have a fix waiting to be merged into the main branch. It will probably take a few days. Once that happens, it should be in the next alpha. So hopefully in 2020.2.0a8, but possibly in 2020.2.0a9.
     
    andrar likes this.
  28. KevinWelton

    KevinWelton

    Joined:
    Jul 26, 2018
    Posts:
    239
    My comment is solely in regards to using loose .mm and .m files. Sorry for any caused confusion.
     
  29. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Are we able to edit the xcode project (eg. adding an entitlement file) in a post build script like we can do with iOS with the XCode API?

    At the moment this doesn't seem to work:

    Code (CSharp):
    1. [PostProcessBuild(1)]
    2. public static void PostProcess(BuildTarget buildTarget, string buildPath)
    3. {
    4.     var project = new PBXProject();
    5.     project.ReadFromFile(buildPath);
    6. }
    7.  
    -> UnauthorizedAccessException: Access to the path '/Users/me/Builds/MyApp/MyApp.xcodeproj' is denied.
     
  30. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    You should be able to. Is that the right path?
     
  31. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Yeah the path is correct, I also tried reading a dummy .txt file in the same folder and it worked fine.
    Could it be a race condition? My script running while Unity hasn't released the project file yet?
     
  32. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    @Tautvydas-Zilys It looks like the project doesn't pick up any of the external libraries/bundles. A standard build grabs everything it needs, but an xcode project has none of them.
    Are supposed to do this manually or is there something special to do? All my libraries have the mac os x64 platform enabled in the inspector.
     
    Last edited: Jul 1, 2020
  33. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Sorry I missed your last reply.

    Regarding the script not working: did you try placing a breakpoint in that function and seeing whether the xcode project is on disk at that time?

    As for the external libraries bundles, looks like you're running into this issue: https://issuetracker.unity3d.com/issues/macos-bundle-plugins-are-not-linked-on-xcode-project-export

    The fix is planned for 2019.4. I don't have an ETA for it unfortunately. Until it is fixed, you may be able to work around it by editing the Xcode project yourself.
     
  34. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Thanks I'll give it a go.
    New 2019.4.2 came out today but reading the changelog it doesn't look like it includes a fix for this :)
     
  35. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    @Tautvydas-Zilys So I did a few tests:
    - Added a breakpoint, the file is there. I'm able to double click on it and open it in xcode.
    - I checked the file permissions and all users have read/write access
    - I used the Finder's Go tool to go directly to the file location I get from the code, and it is the right file.

    scratching me head :confused:
     
  36. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Ah I see the mistake. MyApp.xcodeproj is a folder, not a file. Try this:

    Code (csharp):
    1. var project = new PBXProject();
    2. project.ReadFromFile(Path.Combine(buildPath, "project.pbxproj"));
     
    Numa likes this.
  37. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Ha good catch! Awesome that was it, thanks so much for your help!

    (Btw the helper method PBXProject.GetPBXProjectPath() ,which I think usually takes care of this, only seems to work with iOS project structures. It returns a wrong path with mac os projects).
     
    Last edited: Jul 4, 2020
    Alex_StudioDrydock likes this.
  38. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Hello,
    Is there a way to add the apple developer team ID inside Unity for a macOS app ?
     
  39. flip_the_unflappable

    flip_the_unflappable

    Joined:
    Jul 9, 2020
    Posts:
    11
    It seems strange that the setting "Create Xcode Project" in the Build Settings window saves this change to Library/SourceAssetsDB and not in ProjectSettings/ProjectSettings.asset

    The documentation for Unity explicitly says that you should mark the Library/ directory as ignored for source control systems...

    Is this is the intended behavior?
     
  40. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    The settings in Build Settings window are generally expected to change multiple times as you test and develop your game and it really depends on how you want to configure your build for that specific time you build it. It might also depend on the person who's doing the building: perhaps a developer wants to build it with debugger enabled, while QA wants to build a non-development build. These settings are considered per-user rather than per-project for this reason.

    If you want your project to always revert to "Create Xcode project", you could do something like this: https://forum.unity.com/threads/clo...-silicon-dlls-failing-in-macos-build.1066970/