I have a TAssetPtr in my class like this:
class ANPC : public ACharacter
{
///...
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = NPCMessage)
TAssetPtr<class UTexture2D> Face;
}
In blueprints, I can see my Face variable show up, and I can assign a Texture2D to it… but every time I check the NPC’s TAssetPtr.Get() in render, it always comes up NULL.
I think it is because of TAssetPtr
being a weak pointer. I tried using a TSubobjectPtr but that becomes BlueprintReadOnly…
Is there a way to make the TAssetPtr
retain the reference it got previously in blueprints and not become NULL?
Edit: This problem doesn’t happen when the texture is first imported into UE4 editor. if I import a texture, assign it to Face in blueprints, and run, then the tex isn’t NULL then.
But if the texture was already loaded into the editor before, and I try to launch the game, the tex is NULL then.
- I just found if i hit “Reimport” on the image, it seems to work