このページでは iOS デプロイに特有の最適化について説明します。
UnityEngine 名前空間のほんどの関数は C/C++で実装されています。C/C++関数を Mono スクリプトからコールすることはパフォーマンスオーバーヘッドを伴います。そこで Script Call Optimization を利用すると、毎フレーム 1 から 4 ミリ秒の節約ができます。
iOS Script Call Optimization は Player Settings ウィンドウ( Edit > Project Settings > Player) を開き、下のような iOS アイコンを選択します。
Other Settings セクションの Script Call Optimization* 設定を表示します。
この設定のオプションには以下の通りです。
Unity iOS ではアプリケーションがレンダリングループを実行する頻度を変更することが可能です。デフォルトでは 30 フレーム毎秒です。バッテリー消費を節約するためにこの数字を下げることはできますが、この節約はフレーム更新が犠牲になります。反対にフレームレートを増やして、タッチ入力や加速度センサー処理といった、他の処理よりもレンダリングの優先度をあげることができます。フレームレートがどのようにゲームプレイへ影響するかを判断するには、フレームレートを変えて実験してみる必要があります。
もしアプリケーションが重たい計算処理やレンダリングを伴い、例えば 15 フレーム毎秒しか維持できない場合、希望のフレームレートを 15 以上に設定したからといってパフォーマンスは上がりません。より高いフレームレートを得るためには、アプリケーションを十分に最適化する必要があります。
フレームレートを設定するには Application.targetFrameRate を変更します。
もし加速度センサーがあまりにも頻繁に処理される場合、ゲーム全体のパフォーマンスが結果的に影響を受ける場合があります。デフォルトでは、Unity iOS アプリケーションは加速度センサーを毎秒 60 回サンプリングを行います。加速度センサーのサンプリング周波数を下げるとこでパフォーマンス改善がみられるかもしれません。また、加速度センサーを使用しないゲームでは 0 に設定することもできます。加速度センサーの周波数を変更するには iOS Player Settings の Other Settings の Accelerometer Frequency を変更します。
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.