diff --git a/include/Nazara/Core/AssetCatalog.inl b/include/Nazara/Core/AssetCatalog.inl index 292d6b73b..97b07eb97 100644 --- a/include/Nazara/Core/AssetCatalog.inl +++ b/include/Nazara/Core/AssetCatalog.inl @@ -15,16 +15,15 @@ namespace Nz { Asset asset; - JsonSerializationContext json; - if (!json.Load(path)) - return {}; - - if (!Unserialize(json, "", &asset.m_descriptor)) - return {}; - FilesystemAppComponent* fs = ApplicationBase::Instance()->TryGetComponent(); if (fs) // first try using a FileSystem component to load the asset { + auto json = fs->Load(std::string_view(path.string())); + + if (!Unserialize(*json, "", &asset.m_descriptor)) + return {}; + + std::string filepath = asset.m_descriptor.path.string(); if constexpr (IsStreamingResource) { @@ -38,6 +37,13 @@ namespace Nz if (!asset) // if it fails, use the default loader { + JsonSerializationContext json; + if (!json.Load(path)) + return {}; + + if (!Unserialize(json, "", &asset.m_descriptor)) + return {}; + if constexpr (IsStreamingResource) { asset.m_resource = TResource::OpenFromFile(asset.m_descriptor.path, asset.m_descriptor.parameters);