Fix shader graph assets loading to wait for async task

#3802
This commit is contained in:
Wojtek Figat
2025-11-18 16:11:31 +01:00
parent de9e282bad
commit 2ca435a414
5 changed files with 16 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ public:
/// <param name="id">The asset id.</param>
/// <returns>Loaded asset of null.</returns>
template<typename T>
T* LoadAsync(const Guid& id)
T* Load(const Guid& id)
{
for (auto& e : *this)
{
@@ -26,8 +26,10 @@ public:
return (T*)e.Get();
}
auto asset = (T*)::LoadAsset(id, T::TypeInitializer);
if (asset)
if (asset && !asset->WaitForLoaded())
Add(asset);
else
asset = nullptr;
return asset;
}