I’m trying to log a string then an int value and it’s just not working. I have looked up answers but nothing is helping me at all so can someone please put my question to rest. I just want to log a string + int to screen. This is what I have so far.
if (GEngine) {
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Number in the world: %s"), *iNumberOfBasicUnits);
}
//spawns more units without setting timer
spawnMoreAi(EAiToSpawn::BasicUnit, iMaximumOfBasicUnit - iNumberOfBasicUnits);
if (GEngine) {
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("number of basic units: %d"), iNumberOfBasicUnits);
}
}
if (GEngine) {
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, FString::Printf("Number in the world: %d"), iNumberOfBasicUnits);
}
GEngine works a bit differently when you’re adding in values. I believe this code will work. I’m used to using UE_Log and I’m making the assumption they work the same…which I don’t think is the case. In fact it says to use Fstring::Printf right in the documentation I posted when adding values to your string.