1.输出字符串到output log中 1.1 最普通的三种 1.2 %d打印int,%f打印float,%s string 1.3 自定义 分类的名字 的log 2.输出字符串到屏幕上 三、FString 3.1 FString To FNames 3.2 FString To FText 3.3 FString To Array[uint8] 3.5 FString To const char * 3.6 FString To TCHAR* 3.7 FString To std...
格式化输出,使用方法和C语言print函数一样 #include"Kismet/KismetSystemLibrary.h"UKismetSystemLibrary::PrintString(this, TEXT("Num = %d"),Num); 2、使用Engine的Debug功能 #include"Engine.h"GEngine->AddOnScreenDebugMessage(-1,20, FColor::Green, FString(TEXT("hello!"))); 3、打印到日志 UE_LOG(...
思路:将FName转换为Fstring用UE_LOG(LogTemp, Warnging, TEXT("%s"))输出 根据官网的转换类型参考:https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/StringHandling/ 设str为FName类型的。转化为FString后记得带*才能输出为%s哦 UE_LOG(LogTemp, Warnging, ...
Log an FString %s strings are wanted as TCHAR* by Log, so use *FString() //"MyCharacter's Name is %s" UE_LOG(YourLog,Warning,TEXT("MyCharacter's Name is %s"), *MyCharacter->GetName() ); Log an Int //"MyCharacter's Health is %d" UE_LOG(YourLog,Warning,TEXT("MyCharacter'...
name = JsonObject->GetStringField(TEXT("Name")); //将返回"Mei" //其它JSon类型的解析和字符串类似 } //打印 UE_LOG(LogNet, Warning, TEXT("ReadJson output:\n%s"), *name); 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. ...
在上面的示例中,我们已经展示了如何使用UE_LOG宏将拼接后的字符串输出到日志中。此外,你还可以将拼接后的字符串用于其他逻辑处理,比如设置UI元素的文本、构建网络请求等。 4. (可选)处理字符串拼接过程中可能出现的异常或错误情况 在UE中,FString类的操作通常是安全的,并且不会抛出异常。然而,如果你在处理字符串...
Log Message //"This is a message to yourself during runtime!"UE_LOG(YourLog,Warning,TEXT("This is a message to yourself during runtime!")); Log an FString %s strings are wantedasTCHAR* by Log, so use *FString()//"MyCharacter's Name is %s"UE_LOG(YourLog,Warning,TEXT("MyCharacter...
FString在UE_LOG中输出 *运算符重载:将FString转为一个TCHAR类型指针,再进行输出 其他数据类型转FString 转浮点型 FString::SanitizeFloat(3.32f); 转数字 FString::FormatAsNumber(55); 转整型 FString::FromInt(433); 转布尔类型 bool b = ture;
(StackTrace,StackTaceSize,0);FStringStackTraceText(StackTrace);TArray<FString>StackLines;StackTraceText.ParseIntoArrayLines(StackLines);UE_LOG(LogTemp,Error,TEXT("---Call Stack---"));for(FString&StackLine:StackLines)UE_LOG(LogRHI,Error,TEXT("\t %s"),*StackLine);} 2. 调试 2.1 关闭代码优化...
常用的格式化输出学习: UE_LOG(TestLog,Warning,TEXT("int %d"),1234);UE_LOG(TestLog,Warning,TEXT("float %f"),12.34);FString str=TEXT("test FString");UE_LOG(TestLog,Warning,TEXT("string %s"),*str);UE_LOG(TestLog,Warning,TEXT("[%s] len() is %d"),*str,str.Len()); ...