Hello! I want log the struct array size.
TArray<FMyStruct> Arr{};
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Orange, FString::Printf(TEXT("Struct Size: %s"), *UStruct::GetValueAsString(Arr)));
how to do it correctly?
Thank you
Hello! I want log the struct array size.
TArray<FMyStruct> Arr{};
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Orange, FString::Printf(TEXT("Struct Size: %s"), *UStruct::GetValueAsString(Arr)));
how to do it correctly?
Thank you
int32 arrsize = sizeof(Arr);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Orange, FString::Printf(TEXT("Struct Size: %d"), arrsize));
hope it helps
cheers
TArray<FString> myarray;
GEngine->AddOnScreenDebugMessage(-1, 4.0f, FColor::White, FString::Printf(TEXT("Struct Size: %d"), myarray.Num()));
I had scrumbled up things before
my array is struct type
yes it logs as int the size of my struct array but how to do it in string if it is possible?
I already showed the string in my code. And it does not matter, which contents the array has, I just used FString, could also be anything else)
So:
TArray<FMyStruct> myarray;
GEngine->AddOnScreenDebugMessage(-1, 4.0f, FColor::White, FString::Printf(TEXT("Struct Size: %d"), myarray.Num()));
And pure length number as string
GEngine->AddOnScreenDebugMessage(-1, 4.0f, FColor::White, FString::FromInt(myarray.Num()));
Added corrections, had just bad examples beforeโฆ
this is size in strings and you already have the size in int32 to be logged in numbers
hope it helps
cheers!
thank you very much for the perfect solutions