Metal は、Apple デバイス用の標準的なグラフィックス API です。Unity は iOS、tvOS、macOS で Metal をサポートします (スタンドアロンとエディター)。
Metal は OpenGL ES に比べると Apple プラットフォーム上でより多くの機能を提供します。Metal 使用の利点と欠点は以下の通りです。
Metal を使用する利点
Metal を使用する不利益な点
iOS と tvOS は Apple A7 以降の SoC で Metal サポートがあります。
macOS は、HD 4000 シリーズ以降の Intel HD Graphics と Intel Iris Graphics、AMD GCN ベースの GPU、Nvidia Kepler ベースの GPU 以降をサポートする Metal を搭載しています。
最低 シェーダーコンパイルターゲット は 3.5 です。
Metal はジオメトリシェーダをサポートしません。
Unity エディターとスタンドアロンプレイヤーでデフォルトのグラフィックス API として Metal を使用するには、以下のいずれかを行います。
エディターで、メニューの Edit > Project Settings の順に移動し、Player カテゴリを選択し、Metal Editor Support を有効にします。
または、macOS を使用する場合は、Terminal を開き -force-gfx-metal
コマンドライン引数 を使用します。
Metal は iOS、tvOS 、macOS スタンドアロンプレイヤーではデフォルトで有効です。
Xcode は Metal API の検証を提供しており、不明瞭な問題を追跡するのに使用できます。Metal API の検証を有効にするには以下の手順を行います。
Unityで、iOS 向けにプロジェクトをビルドします。 これにより、Xcode プロジェクトが生成されます。
生成された Xcode プロジェクトを Xcode で開き、Edit Scheme を選択します。
検証エラーが発生すると、XCode で実行中のコードを中断しデバイスログに表示されます。
ノート: 検証を使用すると、CPU 使用率を増加させます。そのため、デバッグのためだけに検証を有効にします。
Metal を使用すると、アプリケーションの実行時に GPU デバイスを選択することが可能です。これにより、様々な GPU 設定でプロジェクトをテストしたり、低出力 GPU を使用して電力を節約することができます。
Unity エディターのターゲット GPU デバイスを変更するには、Unity > Preferences… > General の順に選択し、Device To Use を設定します。
スタンドアロンプレーヤーの GPU デバイスを変更するには、アプリケーションを起動し (File > Build and run を選択) し、表示されたダイアログで Graphics device to use に使用する GPU を設定します。
Metal を使用すると、メモリレスのレンダーターゲットを使用して、iOS や tvOS 10.0 を導入するモバイルデバイスのメモリを最適化できます。 これにより、RenderTexture をシステムメモリにバックアップせずにレンダリングすることができるため、コンテンツはレンダリング中、タイルごとのメモリ (on-tile memory) に一時的に保存されるだけです。
詳しくは RenderTexture.memorylessMode を参照してください。
2018–05–22 編集レビュー を行ってパブリッシュされたページ
Metal 使用に関するアドバイスを 2017.4 で追加
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.