Announcement

Collapse
No announcement yet.

TAssetPtr<UTexture2D> with (BP) Resolve Asset ID: Editor restart requires reimporting textures

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TAssetPtr<UTexture2D> with (BP) Resolve Asset ID: Editor restart requires reimporting textures

    tl;dnr
    C++ baseclass with TAssetPtr<UTexture2D>. Utexture2D is set as class default on child blueprint. I pass the class reference to a UMG Widget, then Get Class Defaults -> Texture 2D Asset ID -> Resolve ID. This works when I have the textures freshly reimported. Restart the editor, Resolve ID returns none. Reimport textures, working again. Why?

    -------------------------------------------
    Hi guys,

    I have a c++ pawn-derived parent class ("building") with a TAssetPtr<UTexture2D> which I use to store thumbnail pictures for my RTS Build Menu. For my child blueprints (House, barracks, headquarter) I set the thumbnail as a class default. To fill my UMG Build menu, I pass in a reference to a building class -> Get Class Defaults -> Texture 2D Asset ID -> Resolve ID to get the thumbnail which can then be turned into the brush.

    This seems to work good enough, yet everytime I restart the editor and begin play, it stops working (Resolve Asset ID returns None). When I reimport the textures, it starts working again.

    Any idea why this is happening or what I should change in order to avoid having to reimport all my thumbnail textures?

    Thanks in advance,

    EcoRI

    PS: I use TAssetPtr<UTexture2D> because the node "Get Class Defaults" would not return a direct UTexture2D Pointer (this has been stated to be by design as the reference cannot be guaranteed to be read-only in BP). I also tried wrapping the UTexture2D Pointer in a struct which can then be retrieved with Node "Get Class Defaults", yet this resulted in a "Graph is linked to external private object" error.
    Last edited by EcoRI; 04-04-2016, 03:49 AM.
Working...
X