Skip to content

MemoryProfilerのスナップショットを実機側からコントロールするツール

License

Notifications You must be signed in to change notification settings

swordlegend/UnityMemoryProfilerSupportKun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnityMemoryProfilerSupportKun

実機側からUnityEditor上のMemoryProfilerに対してSnapShotを実行タイミングを指定することが出来る便利ツールです。

動作環境

動作確認済みUnity

  • Unity2017.4.24f1
  • Unity2018.3.12f1

動作確認済みプラットフォーム

  • iOS
  • Android
  • Windows 10

必要パッケージ

MemoryProfiler本体が別途必要ですので、下記のURLから取得して下さい。 https://bitbucket.org/Unity-Technologies/memoryprofiler またMemoryProfilerに含まれるPackedMemorySnapshotUtility.csを一部改変する必要があります。 static void SaveToFile(string filePath, PackedMemorySnapshot snapshot)の前にpublicを付けpublic static void SaveToFile(string filePath, PackedMemorySnapshot snapshot) として下さい。

ファイル説明

  • UnityMemoryProfilerSupportKunEditor.cs UnityEditor側で使用するファイルです。Editorフォルダの下に置いて下さい。
  • UnityMemoryProfilerSupportKunEditor.cs UnityPlayer(アプリ)側で使用するファイルです。singletonのGameObjectとしてSceneに配置して使用して下さい。

スナップショットの撮り方

スナップショットを撮りたいタイミングで下記のメソッドを実行して下さい。

UnityMemoryProfilerSupportKunClient.instance.Send("スナップショットのファイル名");

シーン切り替え直前・直後に上記メソッドを実行し差分を比較することでメモリーリークの解決の糸口を見つけることが出来る可能性があります。 また、UnityEditor側でスナップショットの保存が終了した際に、UnityMemoryProfilerSupportKunClient.instance.isDonetrueを返します。

ビルド設定

Development Build 及び AutoConnect Profiler の両方にチェックを入れた状態でビルドを行って下さい。

使用方法

前提条件としてMemoryProfilerが使用可能である必要があります。 UnityMemorySProfilerSupportKun Windowの他にMemoryProfiler及びProfilerWindowを開き、Active Profilerを計測対象のアプリケーションと接続して下さい。 Active Profilerとの接続に関する詳細は下記のURLをご確認下さい。 https://docs.unity3d.com/ja/current/Manual/ProfilerWindow.html

サンプルプログラム

下記の2種類のサンプルを用意しています。

Simple

実機側のボタンを押すことでSnapShotを取るシンプルなサンプル。シーンsimple.untyのみビルドの対象として下さい。

SceneMain

Scene切り替えのタイミングでSnapShotを取るサンプル。下記の3シーンをビルドに含めて下さい。

  • SceneMain.unity
  • SceneSub0001.unity
  • SceneSub0002.unity

About

MemoryProfilerのスナップショットを実機側からコントロールするツール

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages