forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssemblyReloadEvents.cs
More file actions
41 lines (37 loc) · 1.55 KB
/
Copy pathAssemblyReloadEvents.cs
File metadata and controls
41 lines (37 loc) · 1.55 KB
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
41
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEngine.Scripting;
namespace UnityEditor
{
public static class AssemblyReloadEvents
{
public delegate void AssemblyReloadCallback();
public static event AssemblyReloadCallback beforeAssemblyReload
{
add => m_BeforeAssemblyReloadEvent.Add(value);
remove => m_BeforeAssemblyReloadEvent.Remove(value);
}
private static EventWithPerformanceTracker<AssemblyReloadCallback> m_BeforeAssemblyReloadEvent =
new EventWithPerformanceTracker<AssemblyReloadCallback>($"{nameof(AssemblyReloadEvents)}.{nameof(beforeAssemblyReload)}");
public static event AssemblyReloadCallback afterAssemblyReload
{
add => m_AfterAssemblyReloadEvent.Add(value);
remove => m_AfterAssemblyReloadEvent.Remove(value);
}
private static EventWithPerformanceTracker<AssemblyReloadCallback> m_AfterAssemblyReloadEvent =
new EventWithPerformanceTracker<AssemblyReloadCallback>($"{nameof(AssemblyReloadEvents)}.{nameof(afterAssemblyReload)}");
[RequiredByNativeCode]
static void OnBeforeAssemblyReload()
{
foreach (var evt in m_BeforeAssemblyReloadEvent)
evt();
}
[RequiredByNativeCode]
static void OnAfterAssemblyReload()
{
foreach (var evt in m_AfterAssemblyReloadEvent)
evt();
}
}
}