WEBVTT 00:00:01.243 --> 00:00:03.090 Now that we've finished our game we need to 00:00:03.090 --> 00:00:04.797 present it to our players. 00:00:04.797 --> 00:00:07.034 One of the greatest things about Unity is that 00:00:07.034 --> 00:00:09.326 once we have created our game we can deploy 00:00:09.326 --> 00:00:11.326 it to many of the current platforms. 00:00:11.826 --> 00:00:13.826 For more detailed information on building and 00:00:13.826 --> 00:00:16.630 build targets please see the lesson linked below. 00:00:17.240 --> 00:00:19.240 Before we build our game we should 00:00:19.240 --> 00:00:20.725 save our scene. 00:00:20.725 --> 00:00:22.725 To build our game we must first open 00:00:22.725 --> 00:00:24.725 the Build Settings window. 00:00:24.725 --> 00:00:29.029 We can do this by selecting File - Build Settings 00:00:29.029 --> 00:00:30.735 or by using the key combination of 00:00:30.735 --> 00:00:34.895 shift plus command or control plus B. 00:00:35.980 --> 00:00:38.709 This brings up the Build Settings window. 00:00:38.709 --> 00:00:42.126 Our current build target is indicated by the Unity logo. 00:00:42.126 --> 00:00:44.126 The blue highlight indicates our focus and 00:00:44.126 --> 00:00:46.896 shows us on the right hand side the build 00:00:46.896 --> 00:00:49.484 options for the currently selected platform. 00:00:50.487 --> 00:00:52.487 We want to build to the web player. 00:00:52.904 --> 00:00:54.904 Our current build target is PC, Mac and 00:00:54.904 --> 00:00:56.656 Linux Standalone. 00:00:57.308 --> 00:00:59.947 To change build targets, select the desired platform 00:00:59.947 --> 00:01:02.899 from the list and click the Switch Platform button 00:01:02.899 --> 00:01:04.899 at the bottom of the window. 00:01:05.813 --> 00:01:07.813 Once we have selected our new build target 00:01:07.813 --> 00:01:10.034 we need to add the scenes we want to build 00:01:10.034 --> 00:01:12.034 to the Build Settings window. 00:01:12.034 --> 00:01:14.351 We can add the current scene by clicking the 00:01:14.351 --> 00:01:16.032 Add Current button. 00:01:16.032 --> 00:01:18.032 Or we can drag and drop any scene from our 00:01:18.032 --> 00:01:20.372 project view in to the field at the top of 00:01:20.372 --> 00:01:21.861 the Build Settings window. 00:01:22.623 --> 00:01:24.623 It's worth noting that we don't need to 00:01:24.623 --> 00:01:26.859 include every scene in our project. 00:01:26.859 --> 00:01:28.389 We only need to include the scenes we 00:01:28.389 --> 00:01:30.210 we want in our game. 00:01:30.210 --> 00:01:32.210 It is also possible to perform a build 00:01:32.210 --> 00:01:34.681 with no scenes in the build Settings window. 00:01:35.414 --> 00:01:38.093 If we do this, Unity will simply build our game 00:01:38.093 --> 00:01:40.815 using the current scene we have open for editing. 00:01:42.600 --> 00:01:44.781 Now we are ready to build our game. 00:01:44.781 --> 00:01:46.587 Let's return to the Build Settings window 00:01:46.587 --> 00:01:48.421 and click the Build button. 00:01:48.421 --> 00:01:50.421 This will bring up a dialogue box asking us 00:01:50.421 --> 00:01:52.421 to choose a build location. 00:01:52.421 --> 00:01:54.421 I like to associate my build location with 00:01:54.421 --> 00:01:57.355 my project, so I will create a new folder 00:01:57.355 --> 00:02:00.063 inside my project called Builds. 00:02:00.063 --> 00:02:01.980 This folder must be placed only on the 00:02:01.980 --> 00:02:03.980 root of our project alongside the 00:02:03.980 --> 00:02:05.980 assets and library folders. 00:02:05.980 --> 00:02:09.600 With the build folder selected let's name the build 00:02:12.241 --> 00:02:14.241 and then click save. 00:02:14.741 --> 00:02:16.741 Unity will now build the web player and 00:02:16.741 --> 00:02:18.741 save it to our Builds folder 00:02:20.995 --> 00:02:23.215 When building a web player Unity creates a 00:02:23.215 --> 00:02:25.215 folder with the name of our game 00:02:25.215 --> 00:02:27.704 and in that folder are 2 files. 00:02:27.704 --> 00:02:30.492 1 is the Unity3D data file, 00:02:30.492 --> 00:02:32.492 which contains the game data, 00:02:32.492 --> 00:02:34.492 and an HTML file which holds the code 00:02:34.492 --> 00:02:37.617 to make a webpage with our game embedded in it. 00:02:37.617 --> 00:02:40.823 We must have both the data file and the HTML file 00:02:40.823 --> 00:02:42.823 to run our game in a browser. 00:02:42.823 --> 00:02:45.576 However we can write a custom HTML file 00:02:45.576 --> 00:02:48.215 to replace the page build by Unity. 00:02:48.215 --> 00:02:50.215 It is also possible to create a custom 00:02:50.215 --> 00:02:53.333 web player template which Unity can use to build 00:02:53.333 --> 00:02:55.333 that custom page automatically. 00:02:56.261 --> 00:02:58.796 To run the game open the HTML file. 00:03:00.097 --> 00:03:02.097 And now we are running a local copy of the 00:03:02.097 --> 00:03:04.097 game in our browser. 00:03:05.522 --> 00:03:07.522 To present this to our audience we need 00:03:07.522 --> 00:03:09.522 to place both the HTML file and the 00:03:09.522 --> 00:03:11.522 data file up on the internet. 00:03:12.257 --> 00:03:14.257 I'm going to open an FTP client and 00:03:14.257 --> 00:03:16.713 place the folder with both the HTML file and 00:03:16.713 --> 00:03:19.962 the data file in it up on my website. 00:03:23.155 --> 00:03:25.155 When the folder has been uploaded we can simply 00:03:25.155 --> 00:03:27.404 enter the address in to our browser 00:03:27.404 --> 00:03:29.404 and play our game. 00:03:33.454 --> 00:03:36.891 And, we win! 00:03:40.692 --> 00:03:42.692 So in these assignments we have learned how to 00:03:42.692 --> 00:03:44.547 create new game objects, 00:03:44.547 --> 00:03:46.284 how to position them in the scene, 00:03:46.284 --> 00:03:47.869 add new components to them, 00:03:47.869 --> 00:03:49.869 write our own custom behaviours for them 00:03:49.869 --> 00:03:51.547 using simple scripting. 00:03:51.547 --> 00:03:53.699 We've seen how to use lights, cameras, 00:03:53.699 --> 00:03:56.047 colliders, triggers, rigid bodies. 00:03:56.047 --> 00:03:58.253 We can collect and count objects. 00:03:58.253 --> 00:04:00.253 Though this is a very simple example 00:04:00.253 --> 00:04:02.253 it covers a large set of basic 00:04:02.253 --> 00:04:05.526 subjects important to understanding how to use Unity. 00:04:06.399 --> 00:04:08.190 For continued learning about Unity 00:04:08.190 --> 00:04:10.190 check the Learn site for more lessons, 00:04:10.190 --> 00:04:11.746 assignments and projects.