diff --git a/Development/Documentation/mono.md b/Development/Documentation/mono.md deleted file mode 100644 index 4a880b7a0..000000000 --- a/Development/Documentation/mono.md +++ /dev/null @@ -1,17 +0,0 @@ -## Mono - -Custom fork: [https://github.com/FlaxEngine/mono](https://github.com/FlaxEngine/mono) with custom features for C# assemblies hot-reloading at runtime without domain unload (more: [https://flaxengine.com/blog/flax-facts-16-scripts-hot-reload/](https://flaxengine.com/blog/flax-facts-16-scripts-hot-reload/)). - -Startup docs about building mono: [https://www.mono-project.com/docs/compiling-mono/](https://www.mono-project.com/docs/compiling-mono/) - -### Notes - -Some useful notes and tips for devs: -* Use `-monolog` to print Mono logs to Flax logs -* When working with mono fork set `localRepoPath` to local repo location in `Source\Tools\Flax.Build\Deps\Dependencies\mono.cs` -* To update mono deps when developing/updating use `.\Development\Scripts\Windows\CallBuildTool.bat -log -ReBuildDeps -verbose -depsToBuild=mono -platform=Windows`, then build engine and run it -* `MONO_GC_DEBUG=check-remset-consistency` - it will do additional checks at each collection to see if there are any missing write barriers -* `MONO_GC_DEBUG=nursery-canaries` - it might catch some buffer overflows in case of problems in code. -* `MONO_GC_DEBUG=:` - will print GC debug to the log file (eg. `4:sgen-gc`). -* Methods `mono_custom_attrs_from_property` and `mono_custom_attrs_get_attr` are internally cached -* If C++ mono call a method in c# that will throw an error, error will be handled but, not completly. Calling relase domain will return random `Access memory violation`. First search for error in c# code. No workaround yet. diff --git a/Flax.flaxproj b/Flax.flaxproj index b93e14df4..23e771811 100644 --- a/Flax.flaxproj +++ b/Flax.flaxproj @@ -4,7 +4,7 @@ "Major": 1, "Minor": 13, "Revision": 0, - "Build": 7003 + "Build": 7004 }, "Company": "Flax", "Copyright": "Copyright (c) 2012-2026 Wojciech Figat. All rights reserved.", @@ -14,7 +14,6 @@ "UseCSharp": true, "UseLargeWorlds": false, "UseReverseZ": true, - "UseDotNet": true, "Windows": { "UseSDL": false, }, diff --git a/Source/Editor/Content/Items/VisualScriptItem.cs b/Source/Editor/Content/Items/VisualScriptItem.cs index 5b2f505d7..5bb29947f 100644 --- a/Source/Editor/Content/Items/VisualScriptItem.cs +++ b/Source/Editor/Content/Items/VisualScriptItem.cs @@ -160,7 +160,7 @@ namespace FlaxEditor.Content } else { - _parameters = Utils.GetEmptyArray(); + _parameters = Array.Empty(); } } @@ -283,9 +283,9 @@ namespace FlaxEditor.Content { if (!_asset) { - _parameters = Utils.GetEmptyArray(); - _methods = Utils.GetEmptyArray(); - _attributes = Utils.GetEmptyArray(); + _parameters = Array.Empty(); + _methods = Array.Empty(); + _attributes = Array.Empty(); return; } if (_parameters != null) @@ -303,7 +303,7 @@ namespace FlaxEditor.Content _parameters[i] = new ScriptMemberInfo(new VisualScriptParameterInfo(this, parameters[i])); } else - _parameters = Utils.GetEmptyArray(); + _parameters = Array.Empty(); // Cache Visual Script methods info var methodsCount = _asset.GetMethodsCount(); @@ -314,7 +314,7 @@ namespace FlaxEditor.Content _methods[i] = new ScriptMemberInfo(new VisualScriptMethodInfo(this, i)); } else - _methods = Utils.GetEmptyArray(); + _methods = Array.Empty(); // Cache Visual Script attributes { @@ -525,7 +525,7 @@ namespace FlaxEditor.Content var baseType = BaseType; if (baseType) return baseType.GetProperties(bindingAttr); - return Utils.GetEmptyArray(); + return Array.Empty(); } /// diff --git a/Source/Editor/Cooker/Steps/DeployDataStep.cpp b/Source/Editor/Cooker/Steps/DeployDataStep.cpp index c0cf2e809..049ae3e36 100644 --- a/Source/Editor/Cooker/Steps/DeployDataStep.cpp +++ b/Source/Editor/Cooker/Steps/DeployDataStep.cpp @@ -30,13 +30,6 @@ bool DeployDataStep::Perform(CookingData& data) Platform::Sleep(10); } FileSystem::CreateDirectory(contentDir); - const String dstMono = data.DataOutputPath / TEXT("Mono"); -#if USE_NETCORE - { - // Remove old Mono files - FileSystem::DeleteDirectory(dstMono); - FileSystem::DeleteFile(data.DataOutputPath / TEXT("MonoPosixHelper.dll")); - } String dstDotnet = data.DataOutputPath / TEXT("Dotnet"); const DotNetAOTModes aotMode = data.Tools->UseAOT(); const bool usAOT = aotMode != DotNetAOTModes::None && aotMode != DotNetAOTModes::NoDotnet; @@ -386,23 +379,6 @@ bool DeployDataStep::Perform(CookingData& data) } } } -#else - if (!FileSystem::DirectoryExists(dstMono)) - { - // Deploy Mono files (from platform data folder) - const String srcMono = depsRoot / TEXT("Mono"); - if (!FileSystem::DirectoryExists(srcMono)) - { - data.Error(TEXT("Missing Mono runtime data files.")); - return true; - } - if (FileSystem::CopyDirectory(dstMono, srcMono)) - { - data.Error(TEXT("Failed to copy Mono runtime data files.")); - return true; - } - } -#endif // Deploy engine data for the target platform if (data.Tools->OnDeployBinaries(data)) diff --git a/Source/Editor/CustomEditors/CustomEditorsUtil.cpp b/Source/Editor/CustomEditors/CustomEditorsUtil.cpp index 3549cb866..03b9269e1 100644 --- a/Source/Editor/CustomEditors/CustomEditorsUtil.cpp +++ b/Source/Editor/CustomEditors/CustomEditorsUtil.cpp @@ -52,16 +52,15 @@ void OnAssemblyLoaded(MAssembly* assembly); void OnAssemblyUnloading(MAssembly* assembly); void OnBinaryModuleLoaded(BinaryModule* module); -MTypeObject* CustomEditorsUtil::GetCustomEditor(MTypeObject* refType) +MType* CustomEditorsUtil::GetCustomEditor(MType* type) { - if (!refType) + if (!type) return nullptr; - MType* type = INTERNAL_TYPE_OBJECT_GET(refType); Entry result; if (Cache.TryGet(type, result)) { if (result.CustomEditorType) - return INTERNAL_TYPE_GET_OBJECT(result.CustomEditorType); + return result.CustomEditorType; MClass* editor = result.CustomEditor ? result.CustomEditor : result.DefaultEditor; if (editor) return MUtils::GetType(editor); @@ -127,12 +126,8 @@ void OnAssemblyLoaded(MAssembly* assembly) continue; // Check if attribute references a valid class - MTypeObject* refType = nullptr; - customEditorTypeField->GetValue(attribute, &refType); - if (refType == nullptr) - continue; - - MType* type = INTERNAL_TYPE_OBJECT_GET(refType); + MType* type = nullptr; + customEditorTypeField->GetValue(attribute, &type); if (type == nullptr) continue; MClass* typeClass = MCore::Type::GetClass(type); diff --git a/Source/Editor/CustomEditors/CustomEditorsUtil.h b/Source/Editor/CustomEditors/CustomEditorsUtil.h index 4ac7b1fe3..4be5c2b96 100644 --- a/Source/Editor/CustomEditors/CustomEditorsUtil.h +++ b/Source/Editor/CustomEditors/CustomEditorsUtil.h @@ -12,6 +12,6 @@ class CustomEditorsUtil public: #if USE_CSHARP - static MTypeObject* GetCustomEditor(MTypeObject* refType); + static MType* GetCustomEditor(MType* type); #endif }; diff --git a/Source/Editor/CustomEditors/Editors/TagEditor.cs b/Source/Editor/CustomEditors/Editors/TagEditor.cs index 60639a8cb..c797b7409 100644 --- a/Source/Editor/CustomEditors/Editors/TagEditor.cs +++ b/Source/Editor/CustomEditors/Editors/TagEditor.cs @@ -679,7 +679,7 @@ namespace FlaxEditor.CustomEditors.Editors return asArray; if (Values[0] is List asList) return asList.ToArray(); - return Utils.GetEmptyArray(); + return Array.Empty(); } set { diff --git a/Source/Editor/GUI/Drag/DragActorType.cs b/Source/Editor/GUI/Drag/DragActorType.cs index ff8c58ddc..4aae19bd1 100644 --- a/Source/Editor/GUI/Drag/DragActorType.cs +++ b/Source/Editor/GUI/Drag/DragActorType.cs @@ -103,7 +103,7 @@ namespace FlaxEditor.GUI.Drag return results; } } - return Utils.GetEmptyArray(); + return Array.Empty(); } } } diff --git a/Source/Editor/GUI/Drag/DragControlType.cs b/Source/Editor/GUI/Drag/DragControlType.cs index d1286053c..76786978a 100644 --- a/Source/Editor/GUI/Drag/DragControlType.cs +++ b/Source/Editor/GUI/Drag/DragControlType.cs @@ -101,7 +101,7 @@ public class DragControlType : DragHelper where U : DragEventA return results; } } - return Utils.GetEmptyArray(); + return Array.Empty(); } } diff --git a/Source/Editor/GUI/Drag/DragScripts.cs b/Source/Editor/GUI/Drag/DragScripts.cs index 3e9024b1e..dfc7ebb2c 100644 --- a/Source/Editor/GUI/Drag/DragScripts.cs +++ b/Source/Editor/GUI/Drag/DragScripts.cs @@ -103,7 +103,7 @@ namespace FlaxEditor.GUI.Drag return results.ToArray(); } } - return Utils.GetEmptyArray