Beispiel #1
0
 public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
 {
     foreach (var importedAsset in deletedAssets)
     {
         if (importedAsset.EndsWith(".cs") == true && importedAsset.EndsWith("aot.compiler.gen.cs") == false)
         {
             AOTGenerator.OnAfterAssemblyReload(delete: true);
             return;
         }
     }
 }
Beispiel #2
0
        public static void CompileAOT()
        {
            string path = null;
            var    obj  = Selection.activeObject;

            if (obj != null)
            {
                path = AssetDatabase.GetAssetPath(obj);
                if (System.IO.File.Exists(path) == true)
                {
                    path = System.IO.Path.GetDirectoryName(path);
                }
            }

            if (string.IsNullOrEmpty(path) == true)
            {
                path = "Assets/";
            }

            AOTGenerator.CompileDirectory(path);
        }
Beispiel #3
0
        private static void OnAfterAssemblyReload(bool delete)
        {
            var asms = UnityEditor.AssetDatabase.FindAssets("t:asmdef");

            foreach (var asm in asms)
            {
                var asmPath     = UnityEditor.AssetDatabase.GUIDToAssetPath(asm);
                var asmNamePath = System.IO.Path.GetDirectoryName(asmPath);

                if (delete == true)
                {
                    var fullDir = asmNamePath + "/aot.compiler.gen.cs";
                    if (System.IO.File.Exists(fullDir) == true)
                    {
                        AssetDatabase.DeleteAsset(fullDir);
                    }
                }
                else
                {
                    AOTGenerator.CompileDirectory(asmNamePath);
                }
            }
        }
Beispiel #4
0
 private static void OnScriptsReloaded()
 {
     AOTGenerator.OnAfterAssemblyReload(delete: false);
 }