Because you used Create EditorOnly DefaultSubobject, use CreateDefaultSubobject insted
Hey guys,
I have a custom PlayerStart in C++ that’s changing the scale of the APlayerStart’s ArrowComponent member, which is created within #if WITH_EDITORONLY_DATA tags. For some reason, when I run UE4Editor.exe with -server (i.e. through UnrealVS) to test, this define is true, yet the ArrowComponent is null.
In my player start’s constructor:
#if WITH_EDITORONLY_DATA
ArrowComponent->SetWorldScale3D(FVector(100, 100, 100));
#endif
In APlayerStart’s constructor:
#if WITH_EDITORONLY_DATA
ArrowComponent = PCIP.CreateEditorOnlyDefaultSubobject<UArrowComponent>(this, TEXT("Arrow"));
//... other code here ...
#endif
Under these conditions, the ArrowComponent doesn’t exist for some reason (trying to scale it leads to a crash, as it’s trying to scale a null object.
Any ideas?