public static void OnPreprocessBuild()
        {
            var scriptingBackend  = AssemblyImportSettingsUtilities.GetCurrentScriptingBackend();
            var activeBuildTarget = EditorUserBuildSettings.activeBuildTarget;
            var compileForAOT     = scriptingBackend == ScriptingImplementation.IL2CPP || !AssemblyImportSettingsUtilities.JITPlatforms.Contains(activeBuildTarget);

            // The EditorOnly dll should aways have the same import settings. But lets just make sure.
            AssemblyImportSettingsUtilities.SetAssemblyImportSettings(EditorAssemblyPath, OdinAssemblyImportSettings.IncludeInEditorOnly);

            if (compileForAOT)
            {
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(AOTAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(JITAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
            }
            else
            {
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(AOTAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(JITAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
            }

            if (compileForAOT)
            {
                // Generates dll that contains all serialized generic type variants needed at runtime.
                List <Type> types;
                if (AOTSupportUtilities.ScanProjectForSerializedTypes(out types))
                {
                    AOTSupportUtilities.GenerateDLL(GenerateAssembliesDir, "OdinAOTSupport", types);
                }
            }
        }
        public static void OnPreprocessBuild()
        {
            BuildTarget platform = EditorUserBuildSettings.activeBuildTarget;

            AssetDatabase.StartAssetEditing();

            try
            {
                // The EditorOnly dll should aways have the same import settings. But lets just make sure.
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, EditorAssemblyPath, OdinAssemblyImportSettings.IncludeInEditorOnly);

                if (AssemblyImportSettingsUtilities.IsJITSupported(
                        platform,
                        AssemblyImportSettingsUtilities.GetCurrentScriptingBackend(),
                        AssemblyImportSettingsUtilities.GetCurrentApiCompatibilityLevel()))
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                }
                else
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);

                    // Generates dll that contains all serialized generic type variants needed at runtime.
                    List <Type> types;
                    if (AOTSupportUtilities.ScanProjectForSerializedTypes(out types))
                    {
                        AOTSupportUtilities.GenerateDLL(GenerateAssembliesDir, "OdinAOTSupport", types);
                    }
                }
            }
            finally
            {
                AssetDatabase.StopAssetEditing();
            }
        }
        public static void OnPreprocessBuild()
        {
            BuildTarget platform = EditorUserBuildSettings.activeBuildTarget;

            try
            {
                // The EditorOnly dll should aways have the same import settings. But lets just make sure.
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, EditorAssemblyPath, OdinAssemblyImportSettings.IncludeInEditorOnly);

                if (AssemblyImportSettingsUtilities.IsJITSupported(
                        platform,
                        AssemblyImportSettingsUtilities.GetCurrentScriptingBackend(),
                        AssemblyImportSettingsUtilities.GetCurrentApiCompatibilityLevel()))
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                }
                else
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);

                    // Generates dll that contains all serialized generic type variants needed at runtime.
                    List <Type> types;
                    if (AOTSupportUtilities.ScanProjectForSerializedTypes(out types))
                    {
                        Type type = typeof(List <RobotDataEntry>);
                        types.Add(type);
                        type = typeof(Int32);
                        types.Add(type);
                        type = typeof(RobotDataEntry);
                        types.Add(type);
                        type = typeof(string);
                        types.Add(type);
                        type = typeof(Vector3);
                        types.Add(type);
                        type = typeof(Quaternion);
                        types.Add(type);
                        type = typeof(RobotDataEntrySettings);
                        types.Add(type);
                        type = typeof(List <float>);
                        types.Add(type);
                        type = typeof(List <bool>);
                        types.Add(type);
                        type = typeof(List <string>);
                        types.Add(type);
                        type = typeof(SingleSerializer);
                        types.Add(type);
                        type = typeof(StringSerializer);
                        types.Add(type);
                        type = typeof(BooleanSerializer);
                        types.Add(type);

                        Debug.Log("TypesStart:");
                        foreach (Type t in types)
                        {
                            Debug.Log(t);
                        }
                        Debug.Log("TypesEnd");

                        AOTSupportUtilities.GenerateDLL(GenerateAssembliesDir, "OdinAOTSupport", types);
                    }
                }
            }
            finally
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }