I have a TSoftObjectPtr UIBlueprint property.
It refers to the asset:
However when I load the asset by
UIBlueprint.Get(), called during BeginPlay() of an actor component.
it only works in Editor, returning a valid UBlueprint* pointer.
But it always fails in packaged build, returning a nullptr.
How to solve it?
update: I’ve tried following the approach in Unreal Doc: Referencing Assets | Unreal Engine, using codes as:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category=Building)
const FSoftObjectPath& AssetRef = BaseMesh.ToStringReference();
BaseMesh = Cast< UStaticMesh>(Streamable.SynchronousLoad(AssetRef));
But still, the asset is only loaded successfully in editor play. While fails by just returning a nullptr in packaged game play.
January 28, 2018, 8:28pm
I double this question! Been onto it since 4.16, but no luck on how async load should work with c++ yet