首页 > 其他分享 >UE4.27, 代码实践, 资源加载 FSoftClassPath / FSoftObjectPath

UE4.27, 代码实践, 资源加载 FSoftClassPath / FSoftObjectPath

时间:2024-03-26 11:37:11浏览次数:13  
标签:__ UE4.27 TEXT FSoftObjectPath BuildForBP FSoftClassPath UsedInBluePrint

//以下的FSoftClassPath/FSoftObjectPath都公开在Editor里设定

 

// item in TArray<FSoftClassPath>
FSoftClassPath temp = FSoftClassPath_UsedInBluePrint_BuildFunc(item);
UClass* LoadedClass = temp.TryLoadClass<AActor>();

FSoftClassPath FSoftClassPath_UsedInBluePrint_BuildFunc(const FSoftClassPath __OriginFSoftClassPath__)
{
FString TargetPath_BuildForBP = TEXT("Blueprint'") + __OriginFSoftClassPath__.GetAssetPathName().ToString() + TEXT("'");
return FSoftClassPath(TargetPath_BuildForBP);
}


// item in TArray<FSoftObjectPath>

FSoftObjectPath temp = FSoftObjectPath_UsedInBluePrint_BuildFunc(item);

UClass* LoadedClass = AssetLoader.LoadSynchronous<UClass>(temp);

FSoftObjectPath FSoftObjectPath_UsedInBluePrint_BuildFunc(const FSoftObjectPath __OriginFSoftObjectPath__)
{
FString TargetPath_BuildForBP = TEXT("Class'") + __OriginFSoftObjectPath__.GetAssetPathName().ToString() + TEXT("_C'");
return FSoftObjectPath(TargetPath_BuildForBP);
}

标签:__,UE4.27,TEXT,FSoftObjectPath,BuildForBP,FSoftClassPath,UsedInBluePrint
From: https://www.cnblogs.com/chenxuanzuo/p/18096228

相关文章

  • UE4.27 bug汇总
    编译时errorC4668:没有将“_WIN32_WINNT_WIN10_TH2”定义为预处理器宏,用“0”替换“#if/#elif”一般为Windows中的宏和UE4冲突所致,需要用如下头文件包裹冲突的头文件:#include"Windows/AllowWindowsPlatformTypes.h"#include"Windows/PreWindowsApi.h"#include"冲突的......
  • UE4.27, Debug issues, "变量已被优化掉,因而不可用"
    调试时添加监控后,变量未被成功监控,显示"变量已被优化掉,因而不可用" 所使用的解决办法从解决方案配置的下拉菜单中选择DebugGameEditor  感谢阅读,敬请斧正......
  • UE4.27, Packaging failed, "is found in memory and is an export but does not have
    打包时发生如下错误"isfoundinmemoryandisanexportbutdoesnothaveallloadflags"通过查阅论坛,问题原因出在,某类的构造函数里包含xxx->SetChildActorClass(ActualOne) 整理到的解决办法并未完全验证1,愿意手动设定ChildActorComponent的话,将原代码改为xxx->SetC......
  • ue4.27 VScode 找不到源文件修复方法
    修改.vscode目录下compileCommands_***.json多个文件 { "file":"E:\\\\UnrealProjects\\\\wargame_sanguo\\\\Source\\\\wargame_sanguo\\\\.vs\\\\ProjectSettings.json", "command":"E:\\UnrealProjects\\w......
  • UE4.27接入安卓SDK
    1.安装AndroidSKD+NDK过程中遇到了报错:Exceptioninthread"main"  java.lang.NoClassDefFoundError:javax/xml/bind/annotation/XmlSchema  网上给的解决方......