在UAssetManager类中,这几个函数基本可以满足我们的加载需求。 TSharedPtr<FStreamableHandle>UAssetManager::LoadPrimaryAssets(constTArray<FPrimaryAssetId>&AssetsToLoad,constTArray<FName>&LoadBundles,FStreamableDelegateDelegateToCall,TAsyncLoadPriorityPriority){returnChangeBundleStateForPrimaryAssets(AssetsToLoad...
蓝图使用见图“Asset manager scan option”;C++使用,重写AssetManager中的StartInitialLoading函数,在函数中调用ScanPathForPrimaryAssets或ScanPathsForPrimaryAssets。 查询:如GetPrimaryAssetIdList或GetPrimaryAssetData 加载卸载:资源管理器函数 LoadPrimaryAssets、LoadPrimaryAsset 和 LoadPrimaryAssetsWithType 可用于在适当...
因为数据表资源没有被蓝图引用,C++中的加载不会被记为引用,所以不会打包数据表,其他资产资源也一样,通过修改AssetManager就可以解决数据表没有被打包的问题,其他资产资源也可以通过这个方法解决。 感谢三连~~~
AAsyncActor::Tick(float DeltaTime) { Super::Tick(DeltaTime); // 在这里可以添加检查StreamableHandle状态的代码,以更新加载进度等 } // 异步加载资源 void AAsyncActor::LoadAssetAsync(const TSoftObjectPath& AssetPath) { // 请求异步加载资源 StreamableHandle = UAssetManager::GetStreamableManager...
AssetManager 通过UAssetManager::Get().ModifyCook函数,来访问 PrimaryAssetTypeInfo(在项目设置中的配置、PrimaryAssetLabelId 等)。 这两个则是新建项目里默认添加的,ModifyCook 里会扫描所有的 PrimaryAssetId 资源,将其中指定的资源添加至 PackageToCook,注意只有这个资源。
onComplate为加载完成时的调用,可以在其中按照第一节的步骤创建ULevelStreamingDynamic对象并设置显隐。 3、资源释放 资源管理一般是由UAssetManager决定,理论上有GC在不需要关心这部分。 void FStreamableManager::Unload(const FSoftObjectPath& Target) 通过FStreamableHandle的GetOwningManager()接口拿到对应的Manager...
FStreamableManager& AssetLoader = UAssetManager::GetStreamableManager(); FSoftObjectPath temp = FSoftObjectPath_UsedInBluePrint_BuildFunc(item); UClass* LoadedClass = AssetLoader.LoadSynchronous<UClass>(temp); FSoftObjectPath FSoftObjectPath_UsedInBluePrint_BuildFunc(const FSoftObjectPath __Origin...
在上一小节,把 GameFeatureData 的配置添加到 AssetManager 之后,在打基础包时会把设置为Registered的 Feature 一起打包。 不过,既然是 Modular Gameplay,不把 Game Feature 打包到基础包内,在运行时按需下载并加载是否可行呢?答案是肯定的,因为 Game Feature 本质上是 Content Only 的 Plugin,所以可以单独将插件内...
直接用C++在FunctionLib中 写一个加载方法就行了。示例: UDreamItem*UDreamFunctionLibrary::LoadItemFromPrimaryAssetId(constFPrimaryAssetId&PrimaryAssetId){UDreamAssetManager&AssetManager=UDreamAssetManager::Get();returnAssetManager.ForceLoadItem(PrimaryAssetId);} ...