Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mac Build breaking when uploaded to storage

Discussion in 'Editor & General Support' started by pingwoh, Apr 14, 2021.

  1. pingwoh

    pingwoh

    Joined:
    Sep 21, 2019
    Posts:
    3
    Hello!

    I'm building a game for my class, and every time I upload the compressed version to a storage site (Google Drive, Canvas, Itch.io etc), it breaks when it is re-downloaded. It compresses fine on my laptop, but if I upload it to Drive and then download it again, I get the message that the app is damaged and cannot be opened (I've attached an example of the error).

    I am aware that this can be solved with a console command, but I cannot expect that everyone who downloads the game will use the command to play it. We're working in Unity 2020.2.2f1, and I've tried building several different ways and on different laptops. Is there any way to fix this problem so that when I build and upload the game it can be downloaded and played? Let me know if you need any further clarification. Thanks!
     

    Attached Files:

  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If the problem is lack of execute permissions on the binary, the problem isn't something Unity can resolve. The Windows OS lacks the concept of execute permissions which Unix like OS's use. Windows has read/write permissions, and whether to execute is determined by file extension. This is why Windows executables all end in ".exe". That file extension effectively fills the same role in Windows.

    You could consider first copying the finished build over to a Linux or Mac computer and setting execute permissions there. If you're then going to compress the files, you'd want to make sure you use a format which preserves these permissions. Zip files for example do not preserve execute permissions (or any permissions if memory serves). I believe going the tar.gz route will preserve permissions, but I haven't owned a Mac since the 80's (Mac LC III), so no idea if OS X natively opens such files. Maybe a Mac user has better suggestions.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
  4. pingwoh

    pingwoh

    Joined:
    Sep 21, 2019
    Posts:
    3
    Thank you so much for your advice, but neither of these options (tar.gz or dmg) have helped me. If anyone has any other suggestions, please let me know.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    "App is damaged" error is a known bug in Unity 2020.2.2f1. If you upgrade to Unity 2020.3.5f1, it should go away.
     
  6. pingwoh

    pingwoh

    Joined:
    Sep 21, 2019
    Posts:
    3
    Do you have any advice for making sure everything upgrades well? I've never upgraded a project in Unity, so anything is appreciated. Thanks!
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    Backup your project first, so that you could restore it if something goes wrong. However, 2020.3.5 is pretty close to 2020.2.2 so I doubt you will run into any upgrading issues.
     
    pingwoh likes this.
  8. ribbonrainbow

    ribbonrainbow

    Joined:
    May 17, 2021
    Posts:
    3
    In case anyone is the same boat (me, lol) and this didn't fix theirs (I'm on 2020.3.16f1), try the following:
    1. In the Unity Editor: Build Settings, check the box that lets you make an xcode project (requires having XCode installed, I believe I have Xcode 11)
    2. Open the XCode project
    3. Build

    That solved my problem :)
     
    Arawan likes this.
  9. wrensey

    wrensey

    Joined:
    Mar 12, 2017
    Posts:
    15
    I just want to say thank you for taking the time to post what actually fixed this, been beating my head against the wall for days trying to figure it out

    Apple makes this s**t too hard!!

    I think Unity should just take away the option to build a macOS app without Xcode on Windowws since it just doesn't work
     
  10. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    88
    It's broken again in Unity 2021.3.2f1.

    Just had to build with Xcode to be able to upload the zipped app to Google Drive and then download the zipped file, uncompress and have it run.
     
    deekpyro likes this.
  11. stfunity

    stfunity

    Joined:
    Sep 9, 2018
    Posts:
    64
    Is that a known issue in 2022.1.11f1? Having similar right now but we were testing both Dropbox and GDrive redownloads after successful build and run on the source Macintosh. Please advise. Also looking for how to do the code signing with UnityEditor.OSXStandalone.MacOSCodeSigning but it appears the namespace isn't supported on my Mac

    Again, running 2022.1.11f1 with the Mac build module installed, VSCode2022 with Xamarin.Mac development installed, MacOS 10.13 High Sierra // 2015 MacBook Pro Intel.
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    No, it should be working in 2022.1.11f1.

    Make sure that the script that calls it is in a folder called "Editor". Also, wrap it in #if UNITY_STANDALONE_OSX/#endif. Then it will be available if target platform is set to Mac in Unity.
     
  13. Lighter02

    Lighter02

    Joined:
    Oct 24, 2015
    Posts:
    2
    I just wanted to share that after also seeing this issue on an earlier version of Unity, I updated Unity 2022.1.13 a few weeks ago.

    While this initially seemed to resolve the issue, I am now seeing this again. Unsure if this is some local issue on my end or if this bug still persists.

    I may have to attempt this with xcode as some of those other posters were able to get working, but it's strange that I was able to publish the first build right after upgrading to 2022 - but none afterwards.

    I'm also on a 2018 Macbook Pro running Monterey.
     
  14. caiotoon

    caiotoon

    Joined:
    Apr 16, 2023
    Posts:
    11
    Having the same issue on Unity
    2022.3.1f1
    . Is this something Unity can fix or is it a limitation on building for Mac on Windows?
     
  15. caiotoon

    caiotoon

    Joined:
    Apr 16, 2023
    Posts:
    11
    Alright, found out the issue is due to windows stripping the execution permissions while compressing the file. If I generate the build and use
    WSL
    (https://learn.microsoft.com/en-us/windows/wsl/) to compress it, the permissions are preserved and MacOS can launch the application after downloading it from anywhere. Without notorization you're still susceptible to being blocked by Gatekeeper from Mac, but overall this will work as expected.
     
  16. mariarosagrasso

    mariarosagrasso

    Joined:
    Feb 23, 2023
    Posts:
    3
    How to?
     
  17. caiotoon

    caiotoon

    Joined:
    Apr 16, 2023
    Posts:
    11
    You can just zip the folder through command line like:

    Code (CSharp):
    1. wsl zip -rq game.zip ./build/*
    But in my case, I wanted a button in the interface, so instead I built a C# script that builds the project then invokes a Windows Process that calls WSL and zips the folder:

    Code (CSharp):
    1.         private void ZipBundle(string zipFileName)
    2.         {
    3.             using var wslZip = new Process();
    4.             wslZip.StartInfo.FileName = "wsl.exe";
    5.             wslZip.StartInfo.Arguments = $"zip -rq ../{zipFileName} ./*";
    6.             wslZip.StartInfo.UseShellExecute = false;
    7.             wslZip.StartInfo.CreateNoWindow = true;
    8.             wslZip.StartInfo.RedirectStandardError = true;
    9.             wslZip.StartInfo.RedirectStandardOutput = true;
    10.             wslZip.StartInfo.WorkingDirectory = GetBuildDirectory();
    11.  
    12.             wslZip.ErrorDataReceived += PrintOutput;
    13.             wslZip.OutputDataReceived += PrintOutput;
    14.  
    15.             wslZip.Start();
    16.             wslZip.BeginErrorReadLine();
    17.             wslZip.BeginOutputReadLine();
    18.             wslZip.WaitForExit();
    19.         }
     
    bithellgames-adarby likes this.
  18. bithellgames-adarby

    bithellgames-adarby

    Joined:
    Jun 6, 2022
    Posts:
    3
    legend! I completely forgot about WSL. This is genius 10/10