UWP Quits Nearly Instantly on XBOX

Introduction:
On Monday, I got my game called Nightly Escape on the Microsoft Marketplace; however, there was a problem when trying to start it up on XBOX.

The Problem:
On Windows, it runs smoothly with no problems. But, with XBOX, when I click play, it shows the icon of the game and quits instantly. The game on the Microsoft store costs money so I need this fixed ASAP. It’s not much though. Been trying to fix it for a week and nothing is helping. I tried debugging it on Visual Studio with my Xbox in Developer Mode and some logs outputs. It seems to be a memory issue. Not too sure. I included a txt file with the log.

I got an Xbox Series X and my friend tried it on his Xbox which is an Xbox Series S with the same results. He was extremely excited to play it as well. Luckily he didn’t pay for it as I gave him a product code.

I tried everything, even using ChatGPT to help with finding out the errors. Unfortunately, errors seem to be caused by Unity itself and none of my code.

In-Depth:
On a normal XBOX, it closes the game almost instantly after it shows the game icon. No “Made with Unity” splash screen.

So I installed the Xbox Dev Kit and switched my Xbox to dev mode. Went to the web page and uploaded the MSI to my Xbox and ran it. This time it shows the “Made with Unity” splash screen and just freezes afterward.

Then from the built solution that was built in Unity, I ran it through to my Xbox with the Remote Machine option and it successfully made it to the Main Menu screen of my game. Before I continue, I am going to share my code to help show more information.

private void Update()
{
    if (Gamepad.current != null)
    {
        play.text = "Play (A)";
        quit.text = "Quit (B)";

        if (Input.GetKeyDown(KeyCode.JoystickButton0))
        {
            // Play Game
            playGame();
        } else if (Input.GetKeyDown(KeyCode.JoystickButton1))
        {
            // Quit Game
            quitGame();
        }
    }
}

This is the update method in the main menu script. It runs the “if (Gamepad.current != null)” successfully as the text changed from “Play” to “Play (A)”, same with the quit text. However, when trying to press A, it doesn’t do anything on the game. In Visual Studio however, it gives a couple of popups with these messages “A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Nightly Escape.exe.” then when I click continue a few times, this message pop-ups “Unhandled exception at 0x00007FFECC91478D (UnityPlayer.dll) in Nightly Escape.exe: 0xC0000005: Access violation reading location 0x0000000000000000.” and I am unable to continue after that.

Conclusion:
So, I am hoping someone on here can help as I ain’t sure what it could be. This is outside my knowledge of this since this seems to have something to do with Unity itself. Not too sure. I am hoping someone could help ASAP so I can finally put a working version on the store. I am currently trying to contact ID@XBOX is they can somehow assist as well.

9880308–1425243–error.txt (520 KB)

Hi, this is the key part of the log:

d3d11: failed to create 2D texture id=517 width=2048 height=2048 mips=12 dxgifmt=77 [D3D error was 8007000e]

8007000e is ERROR_OUT_OF_MEMORY. How much memory does your game use? Could it be using too much for Xbox?

Secondly, did you configure the game to be treated as “game” as opposed to an “app” in settings on Xbox? That increases available memory from 1 GB to 5 GB: https://learn.microsoft.com/en-us/windows/uwp/xbox-apps/system-resource-allocation

Also see this: DirectX and UWP on Xbox One | Games for Windows and the DirectX SDK blog

That could be the problem. I have no idea what I had it setup as but I do know my game runs under 4 GBs.

I ain’t at my computer so I will ask some hypothetical questions. Let’s say this all works out and I am able to play it. That means it works on the development kit but not the commercial.

To add some extra details I forgot to add. When I upload the MSI build generated by Visual Studio, it still doesn’t work on the development platform. But it manages to run successfully when building it directly from Visual Studio using Remote Machine.

Still looking for an answer as ID@Xbox hasn’t gotten back to me. They have responded once to ask me some questions, which I provided 10 minutes after and been waiting for 6 days now.

I do have some real world crash data now. Here are all the crashes.

  • INVALID_POINTER_READ_c0000005_UnityPlayer.dll!Unknown (x1)
  • OOM_c00000fd_DeepByte.NightlyEscape!out_of_memory (x1)
  • INVALID_POINTER_WRITE_OOM_c0000005_DeepByte.NightlyEscape!out_of_memory (x4)

By this data, I can conclude that it’s possibly a memory leak caused by HDRP or it’s marking the game as an app. As I heard that Xbox utilizes less RAM towards apps than games. Which may explain why it works on Windows and doesn’t on Xbox.

Which is strange since on the Microsoft Partner Center, it says Game Overview. Could just be a bug as the whole experience with the dashboard hasn’t been the greatest. It lacks user friendly design.

I do know my game uses an average of 8 GBs

This is an issue, Xbox allows 5 GB for games according to the link above. So if you go close or above that, you are in the crashing territory.

Welp, that will definitely crashing when starting the game but what the reasoning on it closing instantly on startup as when you start the game, the main menu pops up. The main menu is from a seperate scene. The main menu most likely uses less than 4 GBs of RAM. Which that is an estimate.

Got any tips on decreasing the memory on my game? It uses HDRP. I did try to decrease the memory by decreasing texture resolution. That’s the only thing I know how to decrease the memory.

I recommend using the Memory Profiler (Memory Profiler | Memory Profiler | 1.0.0) to figure out what is using the memory in the first place. Make sure to profile the build rather than the editor.

I have used the profiler before. There is a lot of unknown memory data that seems to be relating to the HDRP.

Been a while but I have been busy. I have tested out my game that is installed on my Windows and it uses less than 1 GBs of RAM. The UWP uses less memory than an exe file, which is interesting. But that would mean it should run on Xbox quite find unless I am missing something.

How are you measuring memory used? It’s easy to accidentally look at process working set in task manager (which excludes things like video memory). You need to look at the “Commit Size” column which is hidden by default:.
9910368--1432185--upload_2024-6-26_11-52-19.png
9910368--1432188--upload_2024-6-26_11-52-30.png
9910368--1432191--upload_2024-6-26_11-53-59.png

Followed your instructions and now it’s averaging at 2.2 GBs during gameplay and averaging around 1.3 GBs during the main menu screen. Still not enough to crash the game because of too much memory. Unless for some odd reason, it is marking my game as an app. I heard, it caps it off at 1 GB.

Another curious question, if Xbox games are capped at 5 GBs then what does Xbox Series X use the other 11 GBs for? Minus the Xbox UI.

When you deploy the game to the Xbox, and then on Xbox go to the game’s properties, does it show “App” or “Game”? The store will automatically flag it as “Game” but locally when developing it might not. It could be that there are several different issues - one you run out of memory when you run it as an app, and two - something else completely when run as a game.

I don’t know why these restrictions are in place.

Only UWP games have that restriction, and it’s 5GB to support Xbox One as well as Series S/X. Games made with the full devkits don’t have the same restrictions as the process of making builds enables you to build for specific models.