How to Build and Test your Unity Game
Once you finish the game it is time to build and deploy so your testers can test your game.
Lets check the build settings and make sure everything is set up.
Build For PC, Mac & Linux Stand alone is the default. The target platform defaults to what machine you are on Windows or Mac. You want to Make sure all the scenes for the Game are listed.
Click the Player Settings Button in the Bottom Left Corner.
Here You can set the Company Name, The Name of the Game, and The Version of the Game.
You might also want to check the Resolution and Presentation and that Full Screen Mode is not set to Exclusive Full Screen, if it is don’t forget to add a feature to the Game to exit the Game. Mine is set to Full Screen Resolution. There are Different Settings depending on what you are building for, you can check these by Clicking on the Icons in the top for the different build types.
Another Setting that may need to be changed is Other Settings->Configuration->API Compatibility Level. This Defaults to .Net Standard 2.0. .Net 2.0 is out of date and I am using programming features that are part of the .Net 4.x so I changed mine. You may also want to check which Input Manager is set to be used, I am using the Old Input Manager.
Building the Game
Once you are satisfied with the Resolution Settings and any Other Settings for the Game Close out the project settings. And Click On the Build Button.It will ask you where to save the build. I put mine in a new folder called Windows Build in the Project Folder.
Once the Build Is complete Windows Will Open a window to the Build location. You can run the Game.
Tracking Down the Problem
If you noticed my game Crashed for some reason after clicking the New Game Button. So it appears to be a problem with the Game Scene itself. How do I figure out what is going on. Well I have to look at the log file. On a windows machine this is going to be Users\UserName\AppData\LocalLow\Company Name\GameName\Player.log
On my computer it is located at C:\Users\James\AppData\LocalLow\Ktmarine Studios\Galaxy Shoter\Player.Log
It looks as though there may be a problem with all of my Scriptable Object Variables and I also Am Getting a Null Reference In the Ship and Player Behaviors, along with an Argument Out Of Range Exception in the Movable Behavior. Since it appears that the problem is with every Scriptable Object Variable something about Serialization and did you #ifdef Unity_Editor a section of your serialized properties in any of your scripts? I started with the Variable Base to see if this is where my problem is.
I did in fact use
#if UNITY_EDITOR here. I have a string that is for development use. I have a couple options I can completely remove the Developer Description or just remove the
#if UNITY_EDITOR part. I decided to just comment out the entire code since this is just for development.
Testing to See if the problem was solved
I rebuilt the game, Fixing the typo in the Game Name, and ran the game to see if this fixed my issue.
And the Game Runs Perfectly.