How to BUILD / EXPORT your Game in Unity (Windows | Mac | WebGL)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we'll have a look at exporting your game from unity to a platform of your choosing we go over how you can build for Windows Mac and WebGL this might not be the most interesting of videos but it's something that every developer has to do at some point at least I hope so let's get started let's start by opening our build settings menu we'll go file build settings make sure to add all the scenes you want in your build and you can see here that we have a long list of platforms the default one is the PC Mac and Linux standalone you can easily switch to other platforms by simply selecting them and hitting this switch platform button however lately unity has made the different platforms into optional modules that you can install with unity so in my case I've installed PC Mac and Linux panel on Android and WebGL however I did not include any of the others luckily we can simply select one of the modules it's going to say that the module isn't loaded we just hit open download page and unity will automatically start downloading that module simply run through the installer restart unity and you should see there but no matter what platform you want to build for there are a few things that we need to set up the first one is to go to edit project settings and then quality in here we are able to set the different rendering settings and the cool thing about this is that we can separate it into different levels and we can have each platform default to a certain quality level so right now we are viewing our game ad fantastic that means a pixel I count of 4 full rest texture quality and so on and so on but if I switch to the other levels we can see these settings change we can add new levels or delete some I think we should go ahead and delete some of these levels I'm going to delete the fastest this symbol and the beautiful I think three is plenty for our game for fantastic I'm going to set the pixel light count to 10 keep the texture settings I'm going to bump up the anti-aliasing to 8 and I'm going to leave all other settings as is then for good I'm going to set the pixel light count to 4 anti-aliasing to 2 and keep all the other settings and for fast we can have the pixel light can't be too and I probably also want to have hot shadows only cool so this way we have three different quality levels I'm going to set the standalone to fantastic Android we can just go ahead and set that to fast and WebGL to good but you'll of course have to experiment with these settings depending on the complexity of your game next up we need to change the player settings to do that we go edit project settings and then player and in here we have the different build settings first off we have the company I'm going to write brekkie we have the product name let's write cubes on and then we can choose a default icon and you can even change the cursor if you want to I'm going to leave the cursor as is but I do definitely want a build icon now of course you are going to have to create this somehow I recommend using Photoshop or in my case I'm just going to take a screenshot of our game and then load that into Photoshop and edit it a bit this way we can pretty easily create a cool looking icon for the game but you should really go nuts and just have fun with it creating icons can be challenging but it's also a really good thing to learn alright so when you're done with your logo to save it as a PNG to make sure that you get the transparency you need or if you made it in Photoshop you can just save it as a Photoshop file so I'm just going to take this image here and save it directly into my project so I go to how to make a video game and save it under assets and I'm just going to call this one cubes on and then icon save that a non-unity we should see it appearing make sure to select the icon and change the texture type to sprite to D nui and under compression we'll select none let's say that and that should give us some transparency and make sure our image isn't compressed now we can go again edit project settings player and drag in our icon so from here now it's going to depend on what platform you want to export to so on the screen now you will have some time stamps that you can jump to if you want to skip ahead to a specific platform so if you want to build a standalone file meaning PC Mac or Linux we need to change the player settings on this tab first we'll go resolution and presentation here in change will end up we prefer to have the window in full screen or windowed mode I think because we're making a casual game we would like it to open up in windowed and the default width and height is fine here you can also choose whether or not you would like to display the resolution dialog this is a small window that pops up before your game which enables the player to choose a quality level and a preferred resolution again since this is a mini game I think we should just disable this we can also easily make the window resizable and we can pretty much go ahead and support all aspects then under your icon we can just leave everything as is nudey is going to go ahead and build different sizes of our icon for us under the splash image we can configure stuff like the banner image shown in the dialog box we of course don't have that enabled so we don't care about that and the splash screen that is going to show when you start up the game of course if you are not using you pro your options here are going to be limited but it's very cool that you can easily add different logos through the splash screen customize the animation and the colors you can always go ahead and hit preview and it's going to show you what it will look like in our case I'm just going to change the background image to a white and change the splash style to dark on light this way it fits better with the rest of our game finally we have other settings these can be important for larger games but for now you are definitely not going to need to change anything here finally we need to go to file build settings and this is where we choose our target platform so again here it's going to depend on whether or not you want to install for Windows or Mac and again I have some timestamps on the screen so if you're building for Windows you of course want to select Windows as the target platform as the architrave to choose between 32 and 64-bit almost any modern system will do fine running 64-bit however our game probably won't benefit too much from the difference here so I'm just going to go on the safe side and choose 86 which is equal to 32-bit we don't want to copy any files and we don't want this to be a development build now we can just go ahead and hit build we can go and make a new folder under the how to make a video game project and let's call this one builds inside of this we can create another folder called windows and just to stay totally organized we'll create yet another subfolder called x86 and in here we can then write the name of our game so that means cubed on and then x86 and you can also write a version number for your game but I'm just going to go ahead and hit save so now unity will build all of the necessary files and open up the folder so you can see here that we now have an excel file with a nice icon and a data folder containing all the stuff necessary to run our game if you run the exe it's going to open up a new window with our game and the game is already totally playable however these files here aren't too easy to distribute you can of course go ahead and zip them up by right-clicking on them both getting sent to and then compressed zip folder and now you can send this single file to your friends ask them to unzip it and then play the game but that's not to use of friendly what most games do is create an installer that means just a single file that you open up and then you've gone through the installed process this way the user can choose where he wants the program to be installed you can have desktop shortcuts and an easy way to uninstall the game you really won't do that for us we need some third-party software that will turn these files into a setup file what like to use it's a program called a no setup so if you go to the description that will be a link to this page if we then go down here and choose a download site I'm going to go in a set up five point five point nine exe choose random site and it's going to start downloading it's a very small program you can then run through the Installer and once you're done you can go ahead and open up you know set up compiler so in a setup allows you to customize so many things when it comes to creating the Installer in fact it even allows you to edit the script file that makes it but if you don't have experience creating these sort of files from scratch let's face it not a lot of people do we can go and create a new script file using the script wizard that's it okay let's select next and here we can fill out all of the information publication name cubes on application version 1.0 the publisher break is and I'm just going to link to my YouTube channel here like next we'll just have the destination base folder be the programs files folder and this is fine for the folder name let's like next and this is where we need to tell the Installer what files it needs to install on the system so we'll go ahead and select browse and now we need to find our project car builds folder and then our exe file so I'm just going to go to desktop projects go to the how to make a video game unity project go build windows x86 and select cubes on x86 dot exe hit open so now we've linked it to the main executable file but we also need to include all of the data and this is where it becomes a little bit weird we can make Ino setup also install off the data within this folder but when it does that it doesn't include the folder itself only all of its contents that means that when we install it we're going to have our cubes on x86 exe and then at the same level all these files but we need this to be in a separate folder or else the exe cannot find the data it needs to make sure this is what happens we need to wrap this inside of yet another folder so we'll go ahead and copy the name of this folder and create a new custom folder let's just name this one data would then take the cubes on x86 data folder and move it to the newly created data folder and now we can take our data folder and paste the name back in this means that inside of our data folder is another data folder that contains everything we need you can see the hierarchy up here it's a bit weird that we need to do this but as long as you know this trick it works every time so now we can go back to a know set up hit add folder we can again locate project and once you get to the windows x86 folder you need to select the topmost cubes on data folder not the bottom one or it's not going to work but the folder we just made it's now hit OK and it needs to include all the subfolders we'll then hit next and you can choose the default settings you want here I'm going to hit next you can even input a license file and show some information here and there I'm just going to it next English is fine as the language so that's the custom compiler output folder we'll go ahead and hit browse again let's find a project going to build and then under windows let's go ahead and make a new folder and let's call this one installer that's it okay as the name of our output file we'll set cubes on setup and then x86 and parentheses you can even include a custom setup icon file or a password but I'm just going to use the default one I don't need that level of security let's then hit next finish an inner setup will now go ahead and create a script with all of the settings that we just set and you can go in here and change anything that you'd like the scripting language is fairly easy to understand or you could just go ahead and compile the new script right away let's do that by hitting yes you can also choose to save the script before compiling this is a good idea if you want to go back and change something at a later point so we'll just hit yes and again we'll go under builds this time we'll go into Windows and installer and we'll choose at the file name here cubes on setup script let's hit save it's going to go ahead and compile my file you can see here it says finished now we can open up our builds windows installer folder and in here we now have the cubes on setup x86 exe and this file is now all we need to distribute the script files you can just be totally ignored we can go ahead and delete it if we are satisfied with the results let's close down you know setup and unity and if you now go ahead and run our setup file we'll hit yes we can go through the Installer to our own program I'm just going to install it in the default location we're going to create a desktop icon hit install then you can see that we get the option to launch cube Sun and a shortcut down here to the game so if we double click that it is now going to boot up our game and you can also uninstall the game as with any other program on your system so if you want to build for Mac you should of course change the target platform to Mac OS X and when it comes to distributing on the Mac there are two main possibilities the first one is using the Mac App Store and this can be quite a complicated process you also need to change around a few of the build settings and that's lot of work to be done after you export it from unity you can also take your build and turn it into a dmg that you can then distribute through your website Dropbox or any other file sharing solution I will have a link to a guide for both in the description let's have a look at actually building the game into an app to do that we first select the architecture x86 means 32-bit and under square 64 means 64-bit Universal means that it will run on both but this will also be twice as big any new computer will have no problem supporting 64-bit but since I came into this small we might as well choose 32 we don't want this to be a development build so let's just go ahead and hit build and as you can see I've gone ahead and created a folder inside of our project called builds double click on that and in here we can create a new folder and we'll call this one Mac and inside that will create another subfolder called x86 let's just go inside of the x86 folder and hit select this is going to build everything for us and it's going to open it like this and it's a bit weird that unity opens it this way we'll just take the app folder here and move it inside of the x86 and now we can rename this to anything we'd like I'm going to rename this to cubes on and then x86 now on Windows this is going to display as an ordinary folder so we can simply open it and see all the contents but on Mac this should display as an app that you can then just open up if you want an easy way of sending this from one system to another you can right click go send to and then compress zip folder this will turn it into a sip file and then remove the dot app in the name here and we now have a sip folder containing our app and if you are putting this on a Mac again you can either upload it to the maggot store or turning it into a dmg I check the links in the description so if you want to build for WebGL select the web shield platform and again if you haven't included this when installing unity make sure to click the open download page and download that module there not a lot of settings for this however we do need to have a look at the player settings let's click player settings and let's go to the last tab here which is for WebGL let's have a look under resolution and presentation in here you can choose the default screen width and height which can very easily be modified later in the HTML I'm just going to leave it as is you can also choose a template the default one includes a unity logo a way to maximize the screen and maybe also the title of your game and stuff and some other pretty handy things I think for most people it's a good idea to just choose the default one and then modify it but you of course also go with the totally minimal one so I'm going to select default WebGL doesn't include an icon so that doesn't matter on the splash image we can customize the intro screen and see what it looks like right now if I hit preview I've chosen a background color that's very white as the splash style I've chosen dark on light you can also play with the animation add custom logos and of course some of these features are pro only but still things you can customize it a bit in the free version let's then go other settings you can pretty much leave all these settings as is and the same with the publishing settings some people prefer bumping up the WebGL memory size but with the game this big I think 256 is going to be just fine so now we can just go ahead and hit build and as you can see I've created a build folder inside of our how to make a videogame project let's go on to that let's create another folder called WebGL and under this one let's create a folder called cube thought it's like that select folder and unity will now start building exporting for WebGL does take quite a bit of time and it might look like it's getting stuck especially at the last part here but it will get there so when it's done it's going to open up the WebGL folder and you can see our cube done folder here with the different elements that make up our game first off we have the index.html this is what you run in order to display the game in your browser we also have some template data this is basically just some images a bit of styling and a JavaScript file that is referenced by our HTML file in order to display our game nicely on the release we have the files that actually make up our game I've never actually come across an instance where needed to mess with these only template data and index dot HTML so if we open up index dot HTML we get this error it says that the browser does not support running this WebGL content locally that we need to set it up on a server and then connect to it we're going to click OK a couple of times and you can see the template but the game isn't working of course you can solve this problem if you have a web server or you can create one yourself but most of the time you probably want some way of running your game locally so what we can do instead is use Firefox if you don't have Firefox already go ahead and download it and then right-click and say open with Firefox as of this video Firefox supports running these games locally and you can see working just fine it might take a little while before boots though so now we can actually play our game inside of the browser but how can we distribute our game well here we have a few different options the first one is hosting your game yourself if you've bought some server space you can use a our management solution like FileZilla in order to upload your file to that server but most people probably just want to host it on some kind of marketplace the most common ones for indie games are probably congregate and each dot IO I'll have links in the description on how to add unity games to both of them one thing that you sometimes have to do is to compress this folder we do that by selecting the folder right clicking going sent to and then compressed zipped folder on the Mac you simply right click and hit compress we can also go in directly and edit the HTML so if we right-click on this index file we can open with some kind of text editing software that could be node plus plus visual studio but I like to use sublime text now we can edit the HTML that makes up this template we can add custom styling change the height and width we can add custom elements or delete elements for example if we wanted to have a very minimalistic template we could go ahead and delete both the title the fullscreen button and the logo so now when we save this and run it again we can see that all this stuff is gone so that's pretty much it for this video if you enjoyed it make sure to subscribe to them it's a future one of the Sundays and Wednesdays thanks for watching and I will see you in the next video thanks of the awesome patreon supporters who donated in March and a special thanks to Derek Eames Kirk placed on terrifying James Calhoun and Jason the Tito if you want to support the channel and become a patron yourself you will do so a patron account / brackets thanks a lot guys
Info
Channel: Brackeys
Views: 697,303
Rating: undefined out of 5
Keywords: brackeys, unity, unity3d, beginner, easy, how, to, howto, learn, course, tutorial, tutorials, fix, tip, game, development, develop, games, programming, coding, basic, basics, C#, export, exporting, build, building, webgl, webGL, mac, windows, linux, kongregate, distribute, finish
Id: 7nxKAtxGSn8
Channel Id: undefined
Length: 16min 45sec (1005 seconds)
Published: Wed Apr 12 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.