hello,
so i updated my code to UE 4.8 recently. I fixed up all the warnings and errors that came with the integration.
All except one :
this is the code I have a hard time to migrate to 4.8 without a warning
static ConstructorHelpers::FObjectFinder<UClass> MyBPClass(TEXT("Class'/Game/Blueprints/MyCustomBP.MyCustomBP_C'"));
if (MyBPClass.Object != NULL)
{
MySavedBPClass = Cast<UMyBPClass>(StaticConstructObject(MyBPClass.Object, this, TEXT("MyCustomBPClass")));
}
this gives me the deprecation warning :
warning C4996: 'StaticConstructObject': StaticConstructObject is deprecated, please use NewObject instead. For internal CoreUObject module usage, please use StaticConstructObject_Internal. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
so the question is, how do I convert this to the NewObject paradigm ? I tried simply doing :
MySavedBPClass = NewObject<UMyBPClass>(this, TEXT("MyCustomBPClass"), RF_NoFlags, MyBPClass.Object);
but that caused a crash/assert later at runtime saying that the template type does not match the class type that I am trying to instantiate.
What is the correct way to instantiate a BP class in C++ with UE 4.8 ?