Giter Club home page Giter Club logo

unitymemoryprofilersupportkun's Introduction

UnityMemoryProfilerSupportKun

GitHub package.json version

概要

MemoryProfilerはメモリーリーク等、メモリー関連の調査に必要不可欠なツールですが、GUIから手動で行う場合、完全に同じタイミングでCaptureを実行することは出来ません。 UnityMemoryProfilerSupportKunはスクリプトからのCaptureを容易に運用する為のRuntime APIとEditor拡張をセットにしたものです。

出来ること

  • ScriptからMemoryProfilerのSnapshotを実行し、Application.temporaryCachePathへ保存します。
  • 端末上に保存されたSnapshotをUnityEditorから取得出来ます。

動作環境

動作確認済みUnity

  • Unity2019.4.19f1

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

  • Android

インストール

git を使用する場合

git clone https://github.com/katsumasa/UnityMemoryProfilerSupportKun.git

Unity Package Managerを使用する場合

  1. Window-> PackageManager
  2. Addimageをクリックします
  3. パッケージを加えるためのオプションが表示されます。
    image
  4. ドロップダウンから Add package from git URL を選択します。テキストフィールドと Add ボタンが表示されます
  5. テキストフィールドに https://github.com/katsumasa/UnityMemoryProfilerSupportKun.git を入力します

使い方

  • Prefabs/UnityMemoryProfilerをSceneに配置して下さい。このPrefabは常に存在している必要があることに注意して下さい。
  • アプリケーションをビルドする際、Development Build 及び AutoConnect Profiler の両方にチェックを入れた状態でビルドを行って下さい。
  • MemoryProfilerのCaptureを行う箇所で下記のAPIを実行して下さい。
UnityMemoryProfilerSupportKunClient.instance.TakeCapture("スナップショットのファイル名");

Capture処理が完了すると、下記の変数がtrueになります。

UnityMemoryProfilerSupportKunClient.instance.isDone

例えば、シーン切り替え直前・直後に上記メソッドを実行し差分を比較することでメモリーリークの解決の糸口を見つけることが出来る可能性があります。

UnityMemoryProfilerSupportKunWindow

Window->UnityMemoryProfilerSupportKunWindowでWindowが開きます。

image

Connect to

接続先のPlayerを選択します。

Get Snap List

端末に保存されたMemoryProfilerのsnapの一覧を取得します。

DownLoad

指定されたsnapを任意のフォルダーにダウンロードします。

Delete

指定されたsnapを端末から削除します。

サンプルプログラム

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

Simple

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

SceneMain

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

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

unitymemoryprofilersupportkun's People

Contributors

katsumasa avatar samuryu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.