Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POSSIBILITY CHECK] UMG Utilization #32

Open
azelenski opened this issue Mar 4, 2018 · 2 comments
Open

[POSSIBILITY CHECK] UMG Utilization #32

azelenski opened this issue Mar 4, 2018 · 2 comments

Comments

@azelenski
Copy link

Hey,

I want to know, isn't it possible to show a UUserWidget on this Loading Screen?

I'm trying to implement that by providing a reference to my UMG Blueprint and utilize it during loading process.
But my problem is that I'm weak in C++ and a specially C++ Unreal stuff and this is hard for me to estimate is this I who is writing code with wrong syntax or this is just impossible due to other limitations.

I'm pushing a new property declaration into LoadingScreenSettings.h like so:

// Reference UMG Asset in the Editor
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets")
TSubclassOf wMainMenu;

// Variable to hold the widget After Creating it.
UUserWidget* MyMainMenu;

this is fine, i can provide a UMG BP class to it from editor.
and after I need to do something like this in LoadingScreenModule.cpp:

if (wMainMenu) // Check if the Asset is assigned in the blueprint.
{
// Create the widget and store it.
MyMainMenu = CreateWidget(this, wMainMenu);

	if (MyMainMenu)
	{
		MyMainMenu->AddToViewport();
	}
}

and here comes my troubles.
[1] MyMainMenu = CreateWidget(this, wMainMenu); // I need to provide a ref to current PlayerController instead of 'this' but i don't know how to get it (if possible at all)
[2] Trying to get this player controller by doing this: GEngine::GetWorld()->GetFirstPlayerController();
[3] Trying to access wMainMenu and MyMainMenu like followings: Settings->StartupScreen.wMainMenu and Settings->MyMainMenu
[4] Is this totally possible to add the UMG into this?

@lucastucious
Copy link

Same question !

@nickdarnell
Copy link
Member

No - it can't be created early enough for startup screens - and you'd be running blueprints on another thread. We don't do it in any of our games - the only place it's safe to do is when you're doing server travel / streaming and you don't hard block on loading the levels - in which case it's all running on the main thread still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants