Navigating in game loop

390 views Asked by At

I'm currently developing a UWP Win2D game. I need to navigate to a page in Update Event of CanvasAnimatedControl. I used the code below to do it on UI Thread. It does navigates but page freezes. No exception is thrown.

What is the correct way to navigate in Update event/Game Thread?

CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
() =>
{
    Page.Frame.Navigate(typeof(LevelResultPage));
});
1

There are 1 answers

0
Shaun Hamman On BEST ANSWER

As @Marian Dolinský mentioned in the question comments, the issue here is allowing the page to continue updating during the transition. Setting CanvasAnimatedControl#Paused to true will ensure it doesn't receive Update events and won't freeze.