So I’m not sure if this is a bug or not, I just wanted to check to see if someone knew what was going on.
So I have a blueprint function in c++ with a TArray of a custom UStruct called FBob. So my function looks something like
bool UStaticMeshLibrary::StaticMeshLibrary(TArray<FBob> bob)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, FString::FromInt(bob.Num()));
FBob *temp4 = new FBob;
bob.Add(*temp4);
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, FString::FromInt(bob.Num()));
if (bob.Num()!=0) {GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, FString::FromInt(bob.Num()));}
}
so logically, if the initial bob array had 4 items, then the print sequence should be ‘4,5,5,’. But what’s really bizarre is that the print sequence is ‘4,5,0’. What’s truly astounding about this, is that somehow the compiler realizes bobs size is more than zero and passes me through the conditional, but then immediately after this bob is somehow zero. Can someone please explain to me wtf is going on??