CreateWidget c++

Thank you so much for replying. Basically what i wanna know is how can i create widget in c++ using TArray. This is the code that i normally use when creating widget. e.g ammo widget i created.

.h

UPROPERTY(EditDefaultsOnly)
    TSubclassOf<UUserWidget> AmmoWidget;

UAmmoWidget* AmmoWidgetRef;

.cpp

if (AmmoWidget)
	{
		AmmoWidgetRef = CreateWidget<UAmmoWidget>(GetWorld(), AmmoWidget);
		if (AmmoWidgetRef)
		{
			AmmoWidgetRef->AddToViewport();
		}
	}

What i cant figure out is what is the syntax of CreateWidget function when i have TArray so that i can have the same effect in c++. Hope its making sense.

1 Like