I’m trying to wrap my head around UObject lifetime management - particularly I’m trying to understand if it’s okay to put UObjects inside TVariants?
As far as I understand, UObjects must be created on the heap and only through NewObject, not directly with new - but what would happen if I create UObject on the stack or as a part of another UObject, without indirection?
TVariant uses placement new under the hood, so on the first glance that also should be illegal..I think. However what if TVariant object is a UPROPERTY inside another UObject?
(I’m trying to understand that because I’m seeing how raw pointer marked as UPROPERTY but put inside TVariant starts to point to unallocated memory and that shouldn’t be possible)