Hello,
I’m trying to render main world independently rendered 3D objects on player hud via UMG.
The code I wrote is correctly working. I can see the viewport over the main rendered scene and the actor I’m spawning in it, but background is fully black. I’d like to have a transparent background so I can just see 3D objects overlayed.
This is the code:
UWorld* World = PlayerController->GetWorld();
UObject* Outer = World->GetGameInstance() ? StaticCast<UObject*>(World->GetGameInstance()) : StaticCast<UObject*>(World);
UViewport* MiniMap = ConstructObject<UViewport>(UViewport::StaticClass(), Outer);
MiniMap->BackgroundColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
CanvasPanel->AddChild(MiniMap);
MiniMap->Slot->SetDesiredPosition(FVector2D(60.0f, 280.0f));
MiniMap->Slot->SetDesiredSize(FVector2D(1000.0f, 1000.0f));
AVProjectile* test = Cast<AVProjectile>(MiniMap->Spawn(AVProjectile::StaticClass()));
test->SetActorLocation(FVector(0.0f, 100.0f, 0.0f));