Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Editor build post processor for fixing mac builds created on windows

License

NotificationsYou must be signed in to change notification settings

u-plus-one/UnityOSXBuild

Repository files navigation

A Unity package for zipping builds automatically, and on Windows, fix OSX builds by adding the executable bits in the process.

Usage

Install the package according to theinstallation instructions. Once installed, every OSX build you create, the post processing script will run, zip your build, and if necessary, fixes said build to be able to run on OSX devices.

Project settings

This package comes with project specific settings, found atEdit > Project Settings... > OSX Zip Options.

SettingDescription
Zip Creation MethodWhich method to use for creating the build zip file. (Windows Editor only).
Zip Compression LevelThe compression level to apply when generating the zip file.
Original Build OptionDetermines what happens to the original build directory that was used to create the zip file.
WSL Process TimeoutThe time (in seconds) until the wsl process times out.
Verbose LoggingIf checked, prints additional debugging information about the build process.

Zip Creation Method

WSL

Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.

Warning

To use this option, WSL has to be installed (preferably an Ubuntu distribution, it's currently the only one we've tested), including thezip package on the standard Distribution of WSL on your device.

Warning

To build on external or secondary drives, you have to make sure tomount those drives in WSL too:https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-disk/

Zip Manipulation

A Windows-only solution, that zips the build, then edits very specific bytes of the newly created zip, in order to make it compatible with OSX.

Zip Compression Level

Compression LevelWSLZip Manipulation
NoneNo compression (0 in the zip command)No compression
FastestFast compression (1 out of 9 in the zip command)Fast compression
OptimalBest compression (9 out of 9 in the zip command)Best compression

Installation

Option 1: Package Manager

Open the Package Manager window, click on "Add Package from Git URL ...", then enter the following:

https://github.com/u-plus-one/unityosxbuild.git

Option 2: Manually Editing packages.json

Add the following line to your project'sPackages/manifest.json:

"com.github.u-plus-one.unityosxbuild":"https://github.com/u-plus-one/unityosxbuild.git"

Option 3: Manual Installation (not recommended)

You can also download this repository and extract theEditor directory file anywhere inside your project's Assets folder. (The foldermust be named 'Editor' for it to work)

The Problem

Any build for OSX (otherwise known as MacOS) built on Windows devices, do in generalnot work. Instead, you get presented with an error, sayingThe application "game-name" can't be opened, with no more information.

The reason why OSX builds built on Windows do not work on OSX, is the fact that Windows does not keep track of unix-specific file attributes (read/write/execute attributes), which are needed for OSX to run an executable. This executable attribute generally can only be added on Unix devices, which both Linux and OSX devices are. The only current solutions for creating an OSX build, are building on either Linux or OSX itself.

The Solution

This package automatically creates a zip from the mac build and restores the executable bits, which get lost since Windows does not support them.

If you use theWSL Zip Creation Method, it utilises the Windows Subsystem for Linux to zip the build, so OSX knows how to read, unpack, and fix all files, hence adding the executable bit. It's possible to manually add the executable bit to a file on Linux too, with thechmod command. If WSL is already installed on the system, this is the recommended method.

TheZip Manipulation method, instead, is a Windows-only solution. Instead of relying on a Unix system, it zips the build first, then edits the zip itself and its entries (the files inside), to restore the missing file attributes. To make sure everything works as expected on OSX when unzipping this zip, it changes the zip's Host OS to Unix too, to ensure the required file attributes are applied.

Warning

The zip file should never be unzipped in a Windows environment, since it causes the file attributes to get lost, even when zipped again. Editing the zip's contents with an application (e.g. WinRAR)should be fine.

The zip creation process runs at the very end of the build process, meaning that all changes made during aIPostProcessBuild script are included in the build.

Attribution

@lajawi - Unix attributes research, WSL zipper

@d3tonat0r - Package structure, Manual zip builder


[8]ページ先頭

©2009-2025 Movatter.jp