Delete Orphaned Blueprints Button

Added a button to hunt down and murder the pitiful orphans being left behind when an item was deleted
This commit is contained in:
hyperion51 2020-05-23 02:09:57 +01:00
commit 604acd80b5

View file

@ -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<BlueprintData>().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);