I’ve modified the code a little more now. I’ve created HpBar. Can you please check if this is the right way to do it..?
UCLASS()
class LIFEOFLUCK_API UOLHpBarWidget : public UUserWidget
{
GENERATED_BODY()
public:
UOLHpBarWidget(const FObjectInitializer& ObjectInitializer);
protected:
virtual void NativeConstruct() override;
UPROPERTY(EditAnywhere, Category = Hp)
TObjectPtr<class UProgressBar> HpBarProgress; // HpBar
...
};
void UOLHpBarWidget::NativeConstruct()
{
Super::NativeConstruct();
// 해당 컨트롤을 이름으로 찾기
HpBarProgress = Cast<UProgressBar>(GetWidgetFromName(TEXT("HpBar")));
ensure(HpBarProgress);
UpdateHpBar();
}
I modified it like this. I named it HpBar because I set the Progress Bar as HpBar. That’s how I get the UpdateHp log.
Now the problem is UE_LOG ("LogTemp, Log, TEXT (“UpdateHp: %f”), UpdateHp); I think it’s written differently from what I intended. Because the Hp I thought was 1, but that log is outputting 0. I think that’s why Progress Bar appears gray.