クリエイターの教科書

ChatGPT, Stable Diffusion, Visual Studio, Excelなど教科書

【Unity】Windows版ビルドの仕方

Unityで作ったゲームをウィンドウズ用に発行します。

Windows版の発行の仕方

「ファイル>ビルド設定」でプラットフォームを「Windows」にしてビルドします。

アーキテクチャはIntel64Bitですが、古いPCでも動くようにするなら32bitにしてもいいかもしれません。

 

プレイヤー設定のほうでプロジェクト名や企業名、アイコンを設定できます。

 

ビルドされるとフォルダが開きます。

 

EXEを実行して無事起動を確認すればOK.



最初にMadeWithUnityのロゴが出ますが、無料版だとこれは必ず出るようです。

 

ビルドエラー?

Visual Studio  C++ codeがビルドできない

Internal build system error. BuildProgram exited with code -2146233088.
error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details:
IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
 * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended)
 * Visual Studio 2019 with C++ compilers and Windows 10 SDK
 * Visual Studio 2017 with C++ compilers and Windows 10 SDK
 * Visual Studio 2015 with C++ compilers and Windows 10 SDK

Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables.
Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables.
Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry.

Unable to detect any compatible Visual Studio installation!
 * Found Visual Studio 2022 installation without C++ tool components
 * Found Visual Studio 2019 installation without C++ tool components

 

Visual Studio  C++ codeがビルドできないというエラー。

 

Visual Studioがインストールされていなければ、モジュールから追加しておきましょう。

 

ある場合はVSインストーラーを起動。

C++デスクトップ開発をチェックし、インストールします。

 

 

-Xlint:deprecationオプション

D:\_UNITY\tempV2\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.javaは非推奨のAPIを使用またはオーバーライドしています。
注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。

 

プレイヤー設定でカスタムマニフェストにチェック。

 

あとは同アセット内のマニフェストXMLに「<queries><package android:name="com.google.ar.core" /></queries>」を追加。

参考:「UnityPlayerActivity.javaは非推奨のAPIを使用またはオーバーライドしています」が出てビルドできないとき (zenn.dev)

 

 

 

 

 

本ブログのUnity関連記事一覧はこちら。

www.kyoukasho.net

 

このブログは、ネットや書籍上の情報、個人の体験や感想を中心にまとめたものです。 正確性を期していはいますが、間違い・誤訳等あるかもしれません。 当サイトの情報によって生じたいかなる損失について一切の責任を負わないものとします. あらかじめご了承ください。

プライバシーポリシー |〇利用規約 |〇問い合わせ