From 604acd80b5e04a90f379e15be645147ba7bf1f81 Mon Sep 17 00:00:00 2001 From: hyperion51 Date: Sat, 23 May 2020 02:09:57 +0100 Subject: [PATCH] Delete Orphaned Blueprints Button Added a button to hunt down and murder the pitiful orphans being left behind when an item was deleted --- Assets/Scripts/Editor/DatabaseView.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Assets/Scripts/Editor/DatabaseView.cs b/Assets/Scripts/Editor/DatabaseView.cs index bfea28ead..029412369 100644 --- a/Assets/Scripts/Editor/DatabaseView.cs +++ b/Assets/Scripts/Editor/DatabaseView.cs @@ -194,6 +194,23 @@ public class DatabaseListView : EditorWindow } } + using (new HorizontalScope()) + { + if (GUILayout.Button("Delete Orphaned Blueprints")) + { + int count = 0; + foreach (var blueprintData in _databaseCache.GetAll().ToArray()) + { + if (_databaseCache.Get(blueprintData.Item) == null) + { + _databaseCache.Delete(blueprintData); + count++; + } + } + Debug.Log($"Deleted {count} orphaned blueprints!"); + } + } + if (_queryStatus != null && _queryStatus.RetrievedItems < _queryStatus.GalaxyEntries + _queryStatus.ItemsEntries) { var progressRect = GetControlRect(false, 20);