-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathSampleMemorySnapshot.cs
40 lines (33 loc) · 982 Bytes
/
SampleMemorySnapshot.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using UnityHeapCrawler;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
namespace Sample
{
public static class SampleMemorySnapshot
{
[MenuItem("Tools/Memory/Customized Heap Snapshot")]
public static void HeapSnapshot()
{
var collector = new HeapSnapshotCollector()
.AddRoot(Game.Instance, "Game.Instance")
.AddRootTypes(typeof(UnitsGroup))
.AddTrackedTypes(typeof(Unit))
.AddTrackedTypes(typeof(Sprite))
.AddTrackedTypes(typeof(Texture));
var animators = collector.AddUnityRootsGroup<AnimatorController>
(
"animator-controllers",
"Animator Controllers",
CrawlOrder.SriptableObjects
);
animators.MinItemSize = 1;
collector.UserRootsSettings.MinItemSize = 1;
collector.HierarchySettings.MinItemSize = 1;
collector.HierarchySettings.PrintOnlyGameObjects = false;
collector.PrefabsSettings.MinItemSize = 1;
collector.UnityObjectsSettings.MinItemSize = 1;
collector.Start();
}
}
}