Version: 2021.3
言語: 日本語
Windows の Player 設定
Windows スタンドアロン用の Visual Studio プロジェクトの作成

Windows Player build binaries

When you build a Unity project on the Windows platform, Unity produces the following files, where ProjectName is the name of your project:

  • ProjectName.exe - The project executable. This contains the program entry point which calls into the Unity engine when launched.
  • UnityPlayer.dll - この DLL ファイルにはネイティブの Unity エンジンコードがすべて含まれます。Unity Technologies の証明書で署名されており、エンジンが改ざんされていないか検証されます。
  • *.pdb ファイル - デバッグ用のシンボルファイルです。 Build Settings ウィンドウで Copy PDB files を有効にすると、これらのファイルが Unity によってビルドディレクトリにコピーされます。
  • WinPixEventRuntime.dll - This DLL enables Windows PIX profiler support. Unity only creates this file if you enable the Development Build option in the Build Settings window.
  • ProjectName_Data フォルダー ― このフォルダーは、プロジェクトの実行に必要なすべてのデータを含んでいます。

How to rebuild the game executable

The path to the source code for ProjectName.exe is in the WindowsPlayer folder: Editor\Data\PlaybackEngines\WindowsStandaloneSupport\Source\WindowsPlayer.

To modify the executable, or ship the code which you built yourself (if you want to sign it, for example), you must rebuild the executable and place it in your built game directory.

To build your executable outside of Unity, you need Visual Studio 2019 or 2022 with Desktop development with C++ workload installed.

Windows Build Settings

To create a build for Windows, go to Build Settings (menu:** File > Build Settings). In the Platform list, select Windows, then select Switch Platform.

When you have configured the Build Settings, choose from one of the options below:

  • Build はアプリケーションをプレイヤーにビルドします。
  • Build and Run はアプリケーションをプレイヤーにビルドし、ターゲットプラットフォームでそのプレイヤーを開きます。
Unity の Windows ビルド設定
Unity の Windows ビルド設定

Build Settings

これらの設定を使って、Unity がアプリケーションをビルドする方法を設定します。

設定 機能
Target platform Windows を選択し、Windows プラットフォーム用のアプリケーションをビルドします。
Architecture Select the type of CPU to build for (only applies to Build And Run).
Intel 64-bit Intel/AMD 64 ビット CPU アーキテクチャ。
Intel 32-bit Intel 32 ビット CPU アーキテクチャ。
Copy PDB files この設定を有効にすると、ビルドされた Windows Player に Microsoft プログラムデータベース (PDB) ファイルを加えます。PDB ファイルには、アプリケーションのデバッグ情報が含まれますが、プレイヤーのサイズが大きくなる可能性があります。詳細については、Windows のデバッグ を参照してください。
Create Visual Studio Solution この設定を有効にすると、プロジェクトの Visual Studio Solution ファイルが生成され、Visual Studio で最終的な実行ファイルをビルドできます。
Development Build この設定を有効にすると、ビルドにスクリプトのデバッグシンボルと Profiler を加えます。テスト用に DEVELOPMENT_BUILD#define が設定されます。Development Build を選択すると、Autoconnect Profiler、Deep Profiling Support、Script Debugging、Wait for Managed Debugger の設定も利用可能になります。
Autoconnect Profiler この設定を有効にすると、ビルドに Unity Profiler が自動的に接続されます。
Deep Profiling Support この設定を有効にすると、プロファイラーの ディーププロファイリング に切り替えます。これにより、プロファイラーはアプリケーションのすべての関数呼び出しを検査し、より詳細なプロファイリングデータを返します。Deep Profiling Support を有効にすると、スクリプトの実行が遅くなる場合があります。
Script debugging この設定を有効にすると、スクリプトのコードをデバッグできるようになります。WebGLでは使用できません。
Wait for Managed Debugger この設定を有効にすると、Unity がスクリプトコードを実行する前に、デバッガーを設定するよう促されます。
Compression Method (Lumin と WebGL プラットフォームでは使用不可) Compress the data in your Project when you build the Player. This includes Assets, Scenes, Player settings, and GI data. Choose from the following methods:
Default Windows、Mac、Linux、iOS は、デフォルトでは圧縮しません。Android では、デフォルトの圧縮は ZIP です。ZIP は LZ4HC よりも優れた圧縮結果になりますが、データの解凍が遅くなります。
LZ4 高速な圧縮形式で、開発ビルドに役立ちます。詳細は、BuildOptions.CompressWithLz4 を参照してください。
LZ4HC LZ4 の高圧縮変形でビルドに時間がかかりますが、リリースビルド用により良い結果が得られます。詳細は、BuildOptions.CompressWithLz4HC を参照してください。

Asset Import Overrides

The Asset Import Overrides section allows you to locally override all texture import settings to speed up import and platform switch time. You must avoid shipping your final build with any import overrides, but during development they can be useful to speed up iteration time, especially if assets such as textures resulting in lower resolution is not of any concern.

設定 機能
Max Texture Size Override the maximum imported texture size. Unity imports textures in the lower of two values: this value, or the Max Size value specified in Texture import settings.

The time it takes to import a texture is roughly proportional to the amount of pixels it contains; therefore, reducing maximum allowed texture size can speed up the import times. However, as this setting might result in lower resolution textures, use it only for development purposes.
Texture Compression テクスチャインポート設定 で設定されたテクスチャ圧縮オプションをオーバーライドします。

これは、圧縮テクスチャ形式 のいずれかにインポートされたテクスチャにのみ影響します。
Force Fast Compressor 適用可能な形式 (BC7、BC6H、ASTC、ETC、ETC2) では、より高速で低品質のテクスチャ圧縮モードを使用します。通常、これにより圧縮アーティファクトが増加しますが、多くの形式では、圧縮自体が何倍も高速になります (2 - 20 倍高速)。

この設定はまた、すべてのテクスチャの クランチ テクスチャ圧縮形式を無効にします。

この効果は、すべてのテクスチャに対して、プラットフォームの テクスチャインポート設定Compressor QualityFast に設定したのと同様です。
Force Uncompressed テクスチャを圧縮しないで、代わりに非圧縮形式を使用します。 これはテクスチャ圧縮プロセス全体をスキップするためインポートが高速ですが、結果のテクスチャはより多くのメモリとゲームデータサイズを消費し、レンダリングパフォーマンスに影響を与える可能性があります。

この効果は、すべてのテクスチャに対して、プラットフォームの テクスチャインポート設定CompressionNone に設定したのと同様です。

また、-overrideMaxTextureSize-overrideTextureCompression エディター コマンドライン引数 を使って、アセットインポートのオーバーライド設定を行い、初期のプロジェクトインポートを変更することもできます。

Windowsアプリケーションのビルド

アプリケーションをビルドするには、以下のいずれかを選択します。

  • Build: Compile a Player. The default build is incremental, except for the first build, which is always a full non-incremental (clean) build. To force a clean build instead of an incremental build, select Clean Build from the dropdown menu.
  • Build and run: プレイヤーをコンパイルして、ネイティブのプラットフォームで開きます。このオプションは、常にインクリメンタルビルドを使用します。

  • 2017–07–19 公開ページ

  • Windows スタンドアロンプレイヤービルドバイナリ―[2017.2] で変更(https://docs.unity3d.com/2017.2/Documentation/Manual/30_search.html?q=newin20172) NewIn20172

  • 2018.1でスタンドアロンプレイヤーの Windows XP サポートを停止

Windows の Player 設定
Windows スタンドアロン用の Visual Studio プロジェクトの作成