diff --git a/Source/Engine/Content/Assets/MaterialInstance.cpp b/Source/Engine/Content/Assets/MaterialInstance.cpp index d432a5804..c0d2137f1 100644 --- a/Source/Engine/Content/Assets/MaterialInstance.cpp +++ b/Source/Engine/Content/Assets/MaterialInstance.cpp @@ -115,16 +115,6 @@ void MaterialInstance::OnBaseParamsChanged() ParamsChanged(); } -void MaterialInstance::OnUnload() -{ - if (_baseMaterial) - { - OnBaseUnset(); - _baseMaterial = nullptr; - } - Params.Dispose(); -} - bool MaterialInstance::IsMaterialInstance() const { return true; @@ -242,7 +232,12 @@ Asset::LoadResult MaterialInstance::load() void MaterialInstance::unload(bool isReloading) { - OnUnload(); + if (_baseMaterial) + { + OnBaseUnset(); + _baseMaterial = nullptr; + } + Params.Dispose(); } AssetChunksFlag MaterialInstance::getChunksToPreload() const diff --git a/Source/Engine/Content/Assets/MaterialInstance.h b/Source/Engine/Content/Assets/MaterialInstance.h index 3cf74db03..dc37133d7 100644 --- a/Source/Engine/Content/Assets/MaterialInstance.h +++ b/Source/Engine/Content/Assets/MaterialInstance.h @@ -49,7 +49,6 @@ private: void OnBaseUnset(); void OnBaseUnloaded(Asset* p); void OnBaseParamsChanged(); - void OnUnload(); public: diff --git a/Source/Engine/Core/Collections/Array.h b/Source/Engine/Core/Collections/Array.h index 5efac818e..c122284ed 100644 --- a/Source/Engine/Core/Collections/Array.h +++ b/Source/Engine/Core/Collections/Array.h @@ -466,6 +466,17 @@ public: _count++; } + /// + /// Adds the specified item to the collection. + /// + /// The item to add. + void Add(T&& item) + { + EnsureCapacity(_count + 1); + Memory::MoveItems(_allocation.Get() + _count, &item, 1); + _count++; + } + /// /// Adds the specified item to the collection. ///