diff --git a/src/Unity/Assets/Plugins/CounterDrone.Core/CounterDrone.Core.dll b/src/Unity/Assets/Plugins/CounterDrone.Core/CounterDrone.Core.dll index 2b517f3..587a29b 100644 Binary files a/src/Unity/Assets/Plugins/CounterDrone.Core/CounterDrone.Core.dll and b/src/Unity/Assets/Plugins/CounterDrone.Core/CounterDrone.Core.dll differ diff --git a/src/Unity/Assets/Scripts/Managers/GroupManager.cs b/src/Unity/Assets/Scripts/Managers/GroupManager.cs index 7155024..c2ea6ff 100644 --- a/src/Unity/Assets/Scripts/Managers/GroupManager.cs +++ b/src/Unity/Assets/Scripts/Managers/GroupManager.cs @@ -22,7 +22,7 @@ namespace CounterDrone.Unity _service = new GroupService(new GroupRepository(_db)); } - void OnDisable() { _db?.Dispose(); _db = null; } + void OnDisable() { _db?.Dispose(); _db = null; GC.Collect(); GC.WaitForPendingFinalizers(); } public Group Create(string name, GroupType type, string desc = "") => _service.CreateGroup(name, type, desc); diff --git a/src/Unity/Assets/Scripts/Managers/ModelManager.cs b/src/Unity/Assets/Scripts/Managers/ModelManager.cs index 6a41157..941af42 100644 --- a/src/Unity/Assets/Scripts/Managers/ModelManager.cs +++ b/src/Unity/Assets/Scripts/Managers/ModelManager.cs @@ -24,7 +24,7 @@ namespace CounterDrone.Unity _service = new ModelService(new ModelRepository(_db), _paths); } - void OnDisable() { _db?.Dispose(); _db = null; } + void OnDisable() { _db?.Dispose(); _db = null; GC.Collect(); GC.WaitForPendingFinalizers(); } public ModelInfo Import(string filePath, string name) => _service.ImportModel(filePath, name); public void Delete(string id) => _service.DeleteModel(id); diff --git a/src/Unity/Assets/Scripts/Managers/ReportManager.cs b/src/Unity/Assets/Scripts/Managers/ReportManager.cs index 66c5de6..a784f20 100644 --- a/src/Unity/Assets/Scripts/Managers/ReportManager.cs +++ b/src/Unity/Assets/Scripts/Managers/ReportManager.cs @@ -22,7 +22,7 @@ namespace CounterDrone.Unity _service = new ReportService(_db, _paths); } - void OnDisable() { _db?.Dispose(); _db = null; } + void OnDisable() { _db?.Dispose(); _db = null; GC.Collect(); GC.WaitForPendingFinalizers(); } public SimulationReport Generate(string taskId, TaskFullConfig cfg, List events, string status, float duration) => _service.Generate(taskId, cfg, events, status, duration); diff --git a/src/Unity/Assets/Scripts/Managers/ScenarioManager.cs b/src/Unity/Assets/Scripts/Managers/ScenarioManager.cs index 92a462f..f6a5f32 100644 --- a/src/Unity/Assets/Scripts/Managers/ScenarioManager.cs +++ b/src/Unity/Assets/Scripts/Managers/ScenarioManager.cs @@ -35,7 +35,7 @@ namespace CounterDrone.Unity } } - void OnDisable() { _db?.Dispose(); _db = null; } + void OnDisable() { _db?.Dispose(); _db = null; GC.Collect(); GC.WaitForPendingFinalizers(); } public SimTask CreateTask(string name, string number) => _service.CreateTask(name, number); public void DeleteTask(string id) => _service.DeleteTask(id); diff --git a/src/Unity/Assets/Scripts/Managers/SimulationRunner.cs b/src/Unity/Assets/Scripts/Managers/SimulationRunner.cs index a09eb50..c156455 100644 --- a/src/Unity/Assets/Scripts/Managers/SimulationRunner.cs +++ b/src/Unity/Assets/Scripts/Managers/SimulationRunner.cs @@ -149,7 +149,7 @@ namespace CounterDrone.Unity } public void Stop() => _engine?.Stop(); - void OnDisable() { _db?.Dispose(); _db = null; } + void OnDisable() { _db?.Dispose(); _db = null; GC.Collect(); GC.WaitForPendingFinalizers(); } void OnDestroy() => Stop(); private void SpawnDroneVisual(DroneEntity drone)