File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments