1.7 KiB
1.7 KiB
title, date, excerpt, tags, rating
title | date | excerpt | tags | rating |
---|---|---|---|---|
UE5 C++技巧 | 2022-12-09 17:02:14 | c++ | ⭐ |
取得默认值
GetDefault<ULyraDeveloperSettings>()->OnPlayInEditorStarted();
GetDefault<ULyraPlatformEmulationSettings>()->OnPlayInEditorStarted();
GetMutableDefault<UContentBrowserSettings>()->SetDisplayPluginFolders(true);
模块操作
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
if (AssetRegistryModule.Get().IsLoadingAssets())
{
if (bInteractive)
{
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("DiscoveringAssets", "Still discovering assets. Try again once it is complete."));
}
else
{
UE_LOG(LogLyraEditor, Display, TEXT("Could not run ValidateCheckedOutContent because asset discovery was still being done."));
}
return;
}
加载动态链接库
{
auto dllName = TEXT("assimp-vc141-mt.dll");
#if WITH_VRM4U_ASSIMP_DEBUG
dllName = TEXT("assimp-vc141-mtd.dll");
#endif
{
FString AbsPath = IPluginManager::Get().FindPlugin("VRM4U")->GetBaseDir() / TEXT("ThirdParty/assimp/bin/x64");
//FPlatformProcess::AddDllDirectory(*AbsPath);
assimpDllHandle = FPlatformProcess::GetDllHandle(*(AbsPath / dllName));
}
}
UE4显示MessageBox
struct CORE_API FMessageDialog
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("DiscoveringAssets", "Still discovering assets. Try again once it is complete."));
ref
c++ 中ref关键字的应用
ref()方法的返回值是reference_wrapper类型,这个类的源码大概的意思就是维持一个指针,并且重载操作符。
版本兼容
#if UE_VERSION_OLDER_THAN(4,24,0)
#endif
#if UE_VERSION_OLDER_THAN(5,0,0)
#endif