diff --git a/Source/Engine/Content/Cache/AssetsCache.cpp b/Source/Engine/Content/Cache/AssetsCache.cpp index 609c7cedc..459a9f31f 100644 --- a/Source/Engine/Content/Cache/AssetsCache.cpp +++ b/Source/Engine/Content/Cache/AssetsCache.cpp @@ -235,6 +235,7 @@ bool AssetsCache::Save(const StringView& path, const Registry& entries, const Pa const String& AssetsCache::GetEditorAssetPath(const Guid& id) const { + ScopeLock lock(_locker); #if USE_EDITOR auto e = _registry.TryGet(id); return e ? e->Info.Path : String::Empty; diff --git a/Source/Engine/Content/Content.cpp b/Source/Engine/Content/Content.cpp index 21a96edc1..e0910f48f 100644 --- a/Source/Engine/Content/Content.cpp +++ b/Source/Engine/Content/Content.cpp @@ -320,6 +320,11 @@ bool Content::GetAssetInfo(const StringView& path, AssetInfo& info) #endif } +String Content::GetEditorAssetPath(const Guid& id) +{ + return Cache.GetEditorAssetPath(id); +} + Array Content::GetAllAssets() { Array result; diff --git a/Source/Engine/Content/Content.h b/Source/Engine/Content/Content.h index 5cdee2ccd..654ab6ac0 100644 --- a/Source/Engine/Content/Content.h +++ b/Source/Engine/Content/Content.h @@ -70,6 +70,13 @@ public: /// True if found any asset, otherwise false. API_FUNCTION() static bool GetAssetInfo(const StringView& path, API_PARAM(Out) AssetInfo& info); + /// + /// Finds the asset path by id. In editor it returns the actual asset path, at runtime it returns the mapped asset path. + /// + /// The asset id. + /// The asset path, or empty if failed to find. + API_FUNCTION() static String GetEditorAssetPath(const Guid& id); + /// /// Finds all the asset IDs. Uses asset registry. ///