Download

Billboard Set Sprite from File

Hi there.

I can’t seem to figure out how to load a texture from my content and feed it to my Billboard on construct.
This is some pseudocode of what I want:


Billboard->SetSprite( UTexture2D("/Game/Icons/MyIcon.MyIcon") );

But I’m not sure how to load the file into a variable so I can feed it into the SetSprite function.
How do you achieve this?

I figured it out on my own. Here’s what I did inside my actor constructor:


static ConstructorHelpers::FObjectFinder<UTexture2D> RetrievedSprite(TEXT("/Game/Icons/Editor/Chest.Chest"));    UTexture2D *ChestSprite = RetrievedSprite.Object;
    Billboard->SetSprite( ChestSprite );

I hope it helps someone.
This thread can be closed if deemed right.