Hello,
I don’t know if my problem is really an Unreal bug but the behavior is quite strange and may be unexpected, so I share it with you in bug reports section in cas of.
I use TSubclassOf<> in a TArray for an inventory. It works in editor but often crash in shipping package when I try to access default object where it should not (all checks are here).
// Array definition
TArray<TSubclassOf<AMETA_Seed>> m_SeedSubclassArray;
...
TSubclassOf<AMETA_Seed> seedSubclass;
for (int32 i = 0; i < m_SeedSubclassArray.Num(); i++)
{
seedSubclass = m_SeedSubclassArray[i];
if (seedSubclass != nullptr && seedSubclass->IsValidLowLevel())
{
// Crash here
seedDefaultObject = seedSubclass->GetDefaultObject<AMETA_Seed>();
}
}
I’m just thinking about UPROPERTY on TArray, it may be a garbage collector problem, as is seems pointers are behind TSubclassOf. In this case, I don’t know if this beavior is unexpected or if it’s just not evident. I will search in this way and post I’m finding any clue.
Someone has any idea of what can be wrong with this ?