UE_LOG(LogTemp, Warning, TEXT("Warning!")); UE_LOG(LogTemp, Log, TEXT("Log value: %s"), TEXT("my string")); GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, TEXT("My message")); 自定义 Category: DECLARE_LOG_CATEGORY_CLASS(MyCategory, Log, All) UE_LOG(MyCategory, Log...
示例2:打印日志 UE_LOG(LogTemp, Warning, TEXT("This is a log message!")); 3.0向量和矩阵类型 FVector: 用于表示三维向量(如位置/方向)FRotator: 用于表示旋转(俯仰/偏航/滚转)FMatrix: 矩阵类型,通常用于高级数学运算。 举例如下: FVector MyLocation = FVector(0.0f, 0.0f, 0.0f); FRotator MyRotatio...
UE5 字符串相关 (1)FString 转 std::string FString fStr = "this fString"; std::string cstr(TCHAR_TO_UTF8(*fStr)); (2)std::string 转 FString ClientMessage(FString(cstr.c_str())); (3)UE_LOG 打印 FName FName mapName = TEXT("Login"); UE_LOG(LogGameLogic, Log, TEXT("UMapManag...
inta=100;//输出一个整形变量a的数值UE_LOG(LogTemp,Warning,TEXT("thislog output aint,value:%d"),a);FString str=TEXT("我爱中国");//输出一个字符串变量str的数值,注意,输出字符串,要在FString前面加一个*UE_LOG(LogTemp,Error,TEXT("thislog output a string,value:%s"),*str); 二.自定义日志类...
格式化:UE_LOG宏可以输出不同类型的数据,使用示例: // 输出一个普通字符串,无格式化信息UE_LOG(LogTemp,Log,TEXT("Pring a common string log message!"));// 输出一个 FString 对象,格式符为:%s// 需要特别注意的是FString对象名称需要接【触引用操作符】FString str="Hello World~";UE_LOG(LogTemp,Log...
2、使用Engine的Debug功能 #include"Engine.h"GEngine->AddOnScreenDebugMessage(-1,20, FColor::Green, FString(TEXT("hello!"))); 3、打印到日志 UE_LOG(LogTemp, Warning, TEXT("hello!")); 同可格式化输出
(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 关闭代码优化...
Log格式: 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 wanted as TCHAR* by Log, so use *FString() ...
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. ...
FString的常用函数 // 填充NewString.Reset();NewString.AppendChar('A');for(inti=0;i<10;i++){NewString.AppendInt(i);}// 对比FString strA=TEXT("1234");FString strB=TEXT("1234");if(strA==strB){UE_LOG(TestLog,Warning,TEXT("strA == strB == %s"),*strA);}// 查找 返回索引int32...