public void OnAfterDeserialize() { _views.Clear(); foreach (SerializableInventoryView data in serializedViews) { InventoryView view = new InventoryView(data.name, data.spaces.Length); // Add all the spaces to the view. for (int i = 0; i < data.spaces.Length; ++i) { InventorySpace space = FindSpaceByName(data.spaces[i]); if (space != null) { view.Add(space); } } // Add all the filters to the view. for (int i = 0; i < data.filters.Length; ++i) { view.AddFilter(data.filters[i]); } // Set the sorting method. view.Sorting = data.sortBy; } serializedViews.Clear(); }