c++ - 如何在虚幻引擎中记录来自字符串变量的消息?

标签 c++ game-engine unreal-engine4

我正在尝试从字符串变量记录消息,下面是我使用的代码

std::string s = "ss";//std::to_string(FPaths::GetPath("../"));
 UE_LOG(LogTemp, Warning, *s);

但它不起作用,有人可以告诉我该怎么做吗? enter image description here

最佳答案

最后我在这里回答我自己的问题。

它无法编译,因为我需要在将字符串输入 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/

相关文章:

java - GTGE 的 Java 数学问题

unreal-engine4 - 将 PlasticSCM 与虚幻引擎 4 结合使用

C++ Visual Studio 2015 : non-standard syntax; use '&' to create a pointer to member

c++ - Opencv 链接 CMAKE 不工作 Ubuntu 16.04 Docker

c++ - RPM 弱依赖

c++ - 从文本文件中读取数据

javascript - 计算数字字符串是否循环 |六 Angular 网格圆形世界

java - BitmapFont 按边界获取字符串?

c++ - OnMousePress 脚本在 UE4 中不起作用

python - PyImport_Import 找不到模块