0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Unity] Build Automationで作ったmacOSのアプリが開かない

Last updated at Posted at 2025-09-28

はじめに

こんにちは、ユーゴです。今回は、Unity CloudのBuild Automationで、ビルドに関する問題に直面したので、ご紹介します。

以前、公証まわりの設定ミスも紹介したので、困っている方は併せてご覧ください。

問題

ビルドが成功して、zipファイルをダウンロードし、アプリを起動します。
しかし、ウィンドウが一生開きません。ゲームも開始されません。

また、以下のように作成したアプリをターミナルから起動すると、

command
./BuildTest.app/Contents/MacOS/build-test
output
[UnityMemory] Configuration Parameters - Can be set up in boot.config
    "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-allocator-temp-initial-block-size-main=262144"
    "memorysetup-allocator-temp-initial-block-size-worker=262144"
    "memorysetup-temp-allocator-size-background-worker=32768"
    "memorysetup-temp-allocator-size-job-worker=262144"
    "memorysetup-temp-allocator-size-preload-manager=262144"
    "memorysetup-temp-allocator-size-nav-mesh-worker=65536"
    "memorysetup-temp-allocator-size-audio-worker=65536"
    "memorysetup-temp-allocator-size-cloud-worker=32768"
    "memorysetup-temp-allocator-size-gfx=262144"

というように、メモリセットアップの途中で処理が止まってしまいます。

原因

Macで動作しているHardened Runtimeというセキュリティ層の機能により、未署名の実行可能メモリの割り当てが拒否されていました。
ターミナルの出力がメモリセットアップで止まっているのも、割り当てが拒否されたためだと考えられます。

解決

entitlementsファイルを以下のようにします。

essentials.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
        <true/>
    </dict>
</plist>

allow-unsigned-executable-memoryを有効にすることで、未署名の実行可能メモリ割り当てが可能になります。

アップロード先ですが、おそらく、macOS向けにBuild Automationを設定した場合、公証の設定でentitlementsファイルをアップロードしているはずです。その設定項目に、.entitlementsを指定する項目があると思いますので、設定してください。
必須項目なので、嫌でも分かると思います。

また、Photonを使用している場合には、通信利用のために以下のような設定が必要になります。

photon.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
        <true/>
        <key>com.apple.security.cs.disable-library-validation</key>
        <true/>
        <key>com.apple.security.network.client</key>
        <true/>
    </dict>
</plist>

com.apple.security.network.clientがネットワーク系の項目です。

余談

Unity Discussionに投稿したものの、中々返信がこなく、最終的に自力で解決したという経緯がありました。
必ずしも公式から回答を貰えるわけではなさそうです。ただ、バグ系やベータ版のSDKといったものには、積極的に公式が回答してくれるように見えます。

The App generated by Build Automation won't open

まとめ

いかがだったでしょうか。今回は、Unity CloudのBuild Automationで作ったmacOSアプリが開かなかった件について、entitlementsファイルを修正することで解決できました。

このように、Unityをテーマに取り扱うことや、AWS, 量子コンピューティングなど、幅広いジャンルについてご紹介しております。
お役に立てましたら、いいね・フォローなどよろしくお願いします!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?