Open Rukgul opened 3 years ago
Unfortunately, you can't manually show movie player at the moment, only manual stop, however, it requires you to call stopmovie in Slate thread orthewise it won't work. You may want to add a fake umg loading screen before the actual loading screen, it's kind of tricky. Also, for server travelling, I recommend you use Level Streaming instead.
That is what I have now is a pre-loading screen widget. So I have read your post on the manual stop. But I don't know how to "be in the slate thread". I have a good understanding of the core development concepts and 90% of my project is in cpp. let's say I want to trigger it from a particular function in the player controller. Not sure where to add the code. I at least found this "ENQUEUE_UNIQUE_RENDER_COMMAND" which appears to allow me to call code in the Renderer Thread (not the "Slate" thread. I got past the linking process by adding RHI and RenderCore to my build.cs. but still not sure if I am heading in the right direction.
IN ACTOR TICK:
if (bStopAsyncLoadingScreen)
{
ENQUEUE_UNIQUE_RENDER_COMMAND(StopLoadingScreen,
{
check(IsInRenderingThread());
FRHICommandListImmediate& MyRHICmdList = GRHICommandList.GetImmediateCommandList();
StopAsyncLoadingScreen(MyRHICmdList);
}
);
bStopAsyncLoadingScreen = false;
}
static void ASRBasePlayer::StopAsyncLoadingScreen(FRHICommandList& RHICmdList)
{
GetMoviePlayer()->StopMovie();
}
You can add your code to SSLoadingScreenLayout class. This is the class base for all layouts, you can call StopMovie from here too.
Much thanks. I appreciate that, and I will look at your code in that class but I guess what I fail to connect the dots on is how do I execute the code. In the game thread I can get a pointer and cast it (i.e. game instance, player controller, etc) for the render thread I need to push a command on the stack to avoid racing across stacks. How do I trigger logic in SLoadingScreenLayout class? Do I just do a static function and SLoadingScreenLayout::CallIt(). Sorry I'm just missing this one step!
First thanks for all your efforts and making this available to the community. With so much that has to be built out for even a basic game it is nice to not have to rethink the loading screen! This is likely more of a feature request. Can you add a node/function to start the loading screen early. I have logic that runs on the login server that spins up a new server instance while the client is waiting for call back to know that the server is ready it would be nice to have the loading screen up. Right now I have a 5-7 second delay begin clicking play and before client travel is triggered. Alternatively you can let me know the basic function to call and I can code my own cpp function if that is easier.