打印日志 的几种方式:
UE_LOG(LogTemp, Warning, TEXT(""));
UE_LOG(LogTemp, Warning, TEXT("1111 %f"), value);
连接字符串:
FString str;
str.Append(TEXT("名称:")).Append(name);
UE_LOG(LogTemp, Warning, TEXT("%s"), *str);
切分字符传:
FString str = TEXT("aa,bb,cc");
TArray<FString> strArray;
str.ParseIntoArray(strArray, TEXT(","), false);
遍历所有Actor:
for (TActorIterator<AActor> ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
// Same as with the Object Iterator, access the subclass instance with the * or -> operators.
AActor *Mesh = *ActorItr;
FString name = ActorItr->GetName();
FString location = ActorItr->GetActorLocation().ToString();
FString str;
str.Append(TEXT("名称:")).Append(name).Append(TEXT(" 地址:")).Append(location);
UE_LOG(LogTemp, Warning, TEXT("%s"), *str);
}
遍历所有静态模型Acotr:
for (TActorIterator<AStaticMeshActor> ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
// Same as with the Object Iterator, access the subclass instance with the * or -> operators.
AStaticMeshActor *Mesh = *ActorItr;
}