Guest User

Untitled

a guest
Mar 28th, 2024
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEditor;
  4. using UnityEngine;
  5.  
  6. public static class EditorTestScript
  7. {
  8.     static EditorTestScript()
  9.     {
  10.         Debug.Log("Static Constructor");
  11.  
  12.         AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
  13.         AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload;
  14.     }
  15.  
  16.     [UnityEditor.Callbacks.DidReloadScripts]
  17.     private static void AssemblyReload()
  18.     {
  19.         if (EditorApplication.isCompiling || EditorApplication.isUpdating)
  20.         {
  21.             EditorApplication.delayCall += AssemblyReload;
  22.  
  23.             return;
  24.         }
  25.  
  26.         EditorApplication.delayCall += UpdateDefines;
  27.     }
  28.  
  29.     public static void UpdateDefines()
  30.     {
  31.         Debug.Log("Reload Scripts");
  32.     }
  33.  
  34.     [UnityEditor.InitializeOnLoadMethod]
  35.     public static void Initialise()
  36.     {
  37.         Debug.Log("Initialise On Load");
  38.     }
  39.  
  40.     public static void OnBeforeAssemblyReload()
  41.     {
  42.         Debug.Log("Before Assembly Reload");
  43.     }
  44.  
  45.     public static void OnAfterAssemblyReload()
  46.     {
  47.         Debug.Log("After Assembly Reload");
  48.     }
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment