我正在尝试从字符串变量记录消息,下面是我使用的代码
std::string s = "ss";//std::to_string(FPaths::GetPath("../"));
UE_LOG(LogTemp, Warning, *s);
最佳答案
最后我在这里回答我自己的问题。
它无法编译,因为我需要在将字符串输入 UE_LOG 之前使用 TEXT 宏。
FString s = "ss";
UE_LOG(LogTemp, Warning, TEXT("%s"), *s);
//or
UE_LOG(LogTemp, Warning, TEXT("ss"));
//this should work
UE_LOG(LogTemp, Warning, TEXT("%s"), *FPaths::GetPath("../"));
应该使用 Unreal 版本的数据类型,而不是使用 std 库
关于c++ - 如何在虚幻引擎中记录来自字符串变量的消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38500220/