We have a few cases where we’re using custom components in our code, and we’re finding there seem to be some odd issues after upgrading to Unreal 4.6.1.
For example, there’s a storage depot building which has a StorageComponent, which is a UCLASS derived from UActorComponent, like it should be. We initialize the StorageComponent in the constructor like so, which is the way this sort of thing is done throughout the engine itself:
AOCBuildingStorageDepot::AOCBuildingStorageDepot(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
StorageComponent = ObjectInitializer.CreateDefaultSubobject<UBuildingStorageComponent>( this, TEXT( "StorageComponent" ) );
}
and here’s how it’s declared in the storage depot’s header file:
UPROPERTY(Category=Storage, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess="true"))
class UBuildingStorageComponent* StorageComponent;
We’re suddenly seeing that with 4.6.1, the StorageComponent pointer gets mysteriously nulled out somewhere in between the constructor and the storage depot’s BeginPlay().
What could be causing this?