3テラバイト

プログラム関連備忘録サイト。主にゲーム。

Unity

Unityのメモリ使用量をスクリプトで取得する

投稿日:

こんにちは、今日はUnityのメモリ使用量をスクリプトで取得する方法についてまとめていきます。

確認環境

Unity 2018.4.15f1

メモリ使用量取得

Unityがシステムから予約しているメモリ総量

Profiler.GetTotalReservedMemoryLong()

Unity内部アロケーターが割り当てているメモリ量

システムから予約しているメモリの内、実際にUnityの内部アロケーターによって使用されているメモリ量を取得できます。

Profiler.GetTotalAllocatedMemoryLong()

未使用メモリ量

システムから予約しているメモリの内、未使用のメモリ量を取得できます。

Profiler.GetTotalUnusedReservedMemoryLong()

リンク

Unity – Scripting API: Profiling.Profiler.GetTotalReservedMemoryLong
https://docs.unity3d.com/2018.4/Documentation/ScriptReference/Profiling.Profiler.GetTotalReservedMemoryLong.html

Unity – Scripting API: Profiling.Profiler.GetTotalAllocatedMemoryLong
https://docs.unity3d.com/2018.4/Documentation/ScriptReference/Profiling.Profiler.GetTotalAllocatedMemoryLong.html

Unity – Scripting API: Profiling.Profiler.GetTotalUnusedReservedMemoryLong
https://docs.unity3d.com/2018.4/Documentation/ScriptReference/Profiling.Profiler.GetTotalUnusedReservedMemoryLong.html

-Unity


comment

メールアドレスが公開されることはありません。 が付いている欄は必須項目です


reCaptcha の認証期間が終了しました。ページを再読み込みしてください。

関連記事

no image

UnityのVideo Playerで動画の終了を判定する方法

こんにちは、今日はUnityのVideo Playerで動画の終了を判定する方法についてまとめていきます。 確認環境 Unity 2018.4.15f1 動画の終了を判定する VideoPlayer. …

no image

UnityでPowerShellの実行結果を取得する

以下の例ではGet-ChildItemコマンドレットを引数なしで実行、標準出力への出力をDebug.LogでUnityコンソールに出力しています。 System.Diagnostics.Process …

no image

Unityでアプリケーションの多重起動を制限する方法

こんにちは、今日はUnityでアプリケーションの多重起動を制限する方法についてまとめていきます。 確認環境 Unity 2018.4.15f1 アプリケーションの多重起動を制限する Edit > Pr …

no image

Unityで古いプロジェクトを開いた際に表示されるAPI Update Requiredダイアログ

確認環境 Unity 2019.4.28f1 表示内容 This project contains scripts and/or assemblies that use obsolete APIs.I …

no image

Unityエディタ上で使用できるダイアログを表示する方法

EditorUtility.DisplayDialog関数でダイアログの表示が可能です。 bool isOK = EditorUtility.DisplayDialog("Title&quo …