Skip to content

Commit e6845fa

Browse files
committed
Adding debugging script; this should not be merged.
1 parent 2023d0f commit e6845fa

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

AppDomainTest.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEditor;
4+
using UnityEngine;
5+
using CesiumForUnity;
6+
7+
public class AppDomainTest : MonoBehaviour
8+
{
9+
[InitializeOnLoadMethod]
10+
private static void Initialize()
11+
{
12+
AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload;
13+
AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
14+
}
15+
16+
// void OnEnable()
17+
// {
18+
// Debug.Log($"Adding event handlers");
19+
// AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload;
20+
// AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
21+
// }
22+
//
23+
// void OnDisable()
24+
// {
25+
// Debug.Log("Removing event handlers");
26+
// AssemblyReloadEvents.afterAssemblyReload -= OnAfterAssemblyReload;
27+
// AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload;
28+
// }
29+
30+
private static void OnBeforeAssemblyReload()
31+
{
32+
Debug.Log("BEFORE assembly reload");
33+
34+
var tilesets = Object.FindObjectsByType<Cesium3DTileset>(FindObjectsSortMode.None);
35+
36+
Debug.Log($"Found {tilesets.Length} tilesets");
37+
38+
foreach (var ts in tilesets)
39+
{
40+
ts.WaitUntilIdle();
41+
}
42+
43+
Debug.Log("Done");
44+
}
45+
46+
private static void OnAfterAssemblyReload()
47+
{
48+
Debug.Log("After assembly reload");
49+
}
50+
}

0 commit comments

Comments
 (0)