FMaterialInstance needed a default ctor because it is a field of FMaterial but cannot be initialized before FMaterial itself is initialized. So we had a defautl ctor and we'd finish the initialization later. Conceptually the default material instance should have been new'ed and a pointer to it stored instead.
That's basically what we do now, but to avoid the extra allocation, we in-place new and delete the default material instance into an aligned_storage inside FMaterial.
FMaterialInstance needed a default ctor because it is a field of FMaterial but cannot be initialized before FMaterial itself is initialized. So we had a defautl ctor and we'd finish the initialization later. Conceptually the default material instance should have been new'ed and a pointer to it stored instead.
That's basically what we do now, but to avoid the extra allocation, we in-place new and delete the default material instance into an aligned_storage inside FMaterial.