Add support for virtual Prefab assets created from code

This commit is contained in:
Wojtek Figat
2022-07-26 23:08:19 +02:00
parent adaaaa3e3f
commit cced83ca96
7 changed files with 68 additions and 5 deletions

View File

@@ -460,12 +460,16 @@ Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& typ
Array<Asset*> Content::GetAssets()
{
Array<Asset*> assets;
AssetsLocker.Lock();
Assets.GetValues(assets);
AssetsLocker.Unlock();
return assets;
}
const Dictionary<Guid, Asset*>& Content::GetAssetsRaw()
{
AssetsLocker.Lock();
AssetsLocker.Unlock();
return Assets;
}
@@ -862,6 +866,13 @@ void Content::onAssetUnload(Asset* asset)
LoadedAssetsToInvoke.Remove(asset);
}
void Content::onAssetChangeId(Asset* asset, const Guid& oldId, const Guid& newId)
{
ScopeLock locker(AssetsLocker);
Assets.Remove(oldId);
Assets.Add(newId, asset);
}
bool Content::IsAssetTypeIdInvalid(const ScriptingTypeHandle& type, const ScriptingTypeHandle& assetType)
{
// Skip if no restrictions for the type