Unity 3D Splash screen problem, Windows Phone

Hi. I’m using Unity 3D Free v4.6. For windows phone, I’m developing the game but there is a problem. If Pressing back button in the game splash screen, The game does not respond.
What is the problem ?

How would you like it to respond? The back button handling code is in App.xaml.cs in exported VS solution. By default, it ignores it while the engine is loading. You can change the behaviour yourself if you want to.

Is it possible to post a screen capture of what this will look like in the App.xaml.cs file? I recently had one of my games marked as “non-compliant” by the Windows Phone store because the back button does not exit the app on the “first screen of the application.” All of my screens will work with the back button (using the code that checks for the escape button), but the Unity loading screen does not respond. I simply need the app to close when the user presses the back button while on the unity loading screen.

Any help would be appreciated, as it looks like all of my WP8 games may start to get pulled from the store if I can’t figure this out. :expressionless:

Thank you!
Nick

Is that on Windows Phone 8.0 or 8.1?

I am using 8.1. Would there be a big difference between the two (assuming I may need to alter both versions at some point)?

Well, the generated visual studio templates differ :).

On windows phone 8.0, look for PhoneApplicationPage_BackKeyPress in MainPage.xaml.cs.

On windows phone 8.1, you’ll have to subscribe to this event yourself:

Best place to do the subscription would be in OnLaunched function in App.xaml.cs.

Thank you! Unfortunately I am not extremely comfortable within VS outside of knowing how to add the AdControl and adjust all of the output properties, so I may fail miserably at adding the event listener. I’ll let you know how it goes.

If I add the code to subscribe to the event, would it simply “work” or do I then have to do something to tell it to exit the app?

Since WP and WP8 require this functionality, is this something that might eventually get added into the generated VS templates?

Thanks!

It’s kinda strange that you say it’s required. I’ve never heard of an application fail the certification before due to this - it may be a new requirement. If that is the case, we will consider adding it.

To quit the application on WP8.0 during back button pressed, set e.Handled to “false”.

To quit the application on WP8.1, call this API in the event handler:

Image attached… This was from the certification report. I have multiple games for Windows Phone and Windows Store and this is the first time it has happened, so I am not sure what changed. Plus, this game has been in the store for a month or two now. I did submit a few to the DVLUP site for challenges/rewards, which may have prompted the extra application review. Thanks again for the help!

I guess I am actually working in 8.0. Is this the function within App.xaml.cs that I am supposed to alter? It seems like this is the state where I am supposed to be able to exit the app (the "Made with Unity loading screen). However, I am not sure how to listen for the “PhoneApplicationPage_BackKeyPress” function that is within MainPage.xaml.cs. I am so sorry to keep asking about this, I am just super lost here. :slight_smile: My “back” code works perfectly for scene 0 and above, but that “Made with Unity” page, I believe, is what is causing my game to be considered non compliant.

// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{

}

Thank you!!!
Nick

You don’t need to listen to PhoneApplicationPage_BackKeyPress, just edit that function directly. It will get called when back button gets pressed. Setup a flag whether Unity is loaded, which you can change in Unity_Loaded callback (which itself and its registration is commented out in the default template). Add code to PhoneApplicationPage_BackKeyPress to set e.Cancel to false and return immediately if unity is not yet loaded.

Thanks Tautvydas, this problem had somewhat fixed itself as the tester must have eventually ignored this on my game. Unfortunately I am being called out on this again for a UWP game. This was a game I had release almost 7 versions of and all of them made it through certification, but apparently the tester who got it this time decided it wouldn’t fly anymore. Here is a screenshot from the certification report:


Any help would be appreciated! I tried to look at the new App.xaml.cs file to see if your previous instructions would help but I just can’t see to identify what and where I need to add code for this. It is so frustrating that the 2-3 second splash screen is causing Microsoft to not let this through certification. I am extremely surprised that no one else has run into this.

Thanks!
Nick

I may have spoken too soon, when I re-tested everything it seemed to work OK so I am going back to the tester to see what else might be wrong here.