blob: c081269ed4440d3d1f6819b52a6f3d89cbb36947 (
plain)
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
|
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEngine.UI.Collections;
namespace UnityEngine.UI
{
public static class GraphicRebuildTracker
{
static IndexedSet<Graphic> m_Tracked = new IndexedSet<Graphic>();
static bool s_Initialized;
public static void TrackGraphic(Graphic g)
{
if (!s_Initialized)
{
CanvasRenderer.onRequestRebuild += OnRebuildRequested;
s_Initialized = true;
}
m_Tracked.AddUnique(g);
}
public static void UnTrackGraphic(Graphic g)
{
m_Tracked.Remove(g);
}
static void OnRebuildRequested()
{
StencilMaterial.ClearAll();
for (int i = 0; i < m_Tracked.Count; i++)
{
m_Tracked[i].OnRebuildRequested();
}
}
}
}
#endif // if UNITY_EDITOR
|