Hey,
I’m new to Unreal Engine and currently practicing to code with it in C++.
I made a Widget with an image in its canvas.
How can I access this image from my C++ code ?
I made a new UserWidget class and reparented it.
My current attempt was something like that:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "A Props")
TSubclassOf<class UImage> wImage;
After this step I wanted to call a Tick void in my Widget class and fade my image in and out like I did in blueprint before. My code is currently like that:
Header:
UCLASS()
class VEHICLEEXAMPLE_API UMyUserWidget : public UUserWidget
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "My New User Widget")
FString MyNewWidgetName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "A Props")
TSubclassOf<class UImage> wImage;
virtual void BeginPlay();
void Tick(FGeometry MyGeometry, float InDeltaTime);
float timer;
bool b_;
};
CPP:
#include "VehicleExample.h"
#include "MyUserWidget.h"
void UMyUserWidget::BeginPlay()
{
}
void UMyUserWidget::Tick(FGeometry MyGeometry, float InDeltaTime)
{
}
Thanks