-
Now that we've finished our game we need to
-
present it to our players.
-
One of the greatest things about Unity is that
-
once we have created our game we can deploy
-
it to many of the current platforms.
-
For more detailed information on building and
-
build targets please see the lesson linked below.
-
Before we build our game we should
-
save our scene.
-
To build our game we must first open
-
the Build Settings window.
-
We can do this by selecting File - Build Settings
-
or by using the key combination of
-
shift plus command or control plus B.
-
This brings up the Build Settings window.
-
Our current build target is indicated by the Unity logo.
-
The blue highlight indicates our focus and
-
shows us on the right hand side the build
-
options for the currently selected platform.
-
We want to build to the web player.
-
Our current build target is PC, Mac and
-
Linux Standalone.
-
To change build targets, select the desired platform
-
from the list and click the Switch Platform button
-
at the bottom of the window.
-
Once we have selected our new build target
-
we need to add the scenes we want to build
-
to the Build Settings window.
-
We can add the current scene by clicking the
-
Add Current button.
-
Or we can drag and drop any scene from our
-
project view in to the field at the top of
-
the Build Settings window.
-
It's worth noting that we don't need to
-
include every scene in our project.
-
We only need to include the scenes we
-
we want in our game.
-
It is also possible to perform a build
-
with no scenes in the build Settings window.
-
If we do this, Unity will simply build our game
-
using the current scene we have open for editing.
-
Now we are ready to build our game.
-
Let's return to the Build Settings window
-
and click the Build button.
-
This will bring up a dialogue box asking us
-
to choose a build location.
-
I like to associate my build location with
-
my project, so I will create a new folder
-
inside my project called Builds.
-
This folder must be placed only on the
-
root of our project alongside the
-
assets and library folders.
-
With the build folder selected let's name the build
-
and then click save.
-
Unity will now build the web player and
-
save it to our Builds folder
-
When building a web player Unity creates a
-
folder with the name of our game
-
and in that folder are 2 files.
-
1 is the Unity3D data file,
-
which contains the game data,
-
and an HTML file which holds the code
-
to make a webpage with our game embedded in it.
-
We must have both the data file and the HTML file
-
to run our game in a browser.
-
However we can write a custom HTML file
-
to replace the page build by Unity.
-
It is also possible to create a custom
-
web player template which Unity can use to build
-
that custom page automatically.
-
To run the game open the HTML file.
-
And now we are running a local copy of the
-
game in our browser.
-
To present this to our audience we need
-
to place both the HTML file and the
-
data file up on the internet.
-
I'm going to open an FTP client and
-
place the folder with both the HTML file and
-
the data file in it up on my website.
-
When the folder has been uploaded we can simply
-
enter the address in to our browser
-
and play our game.
-
And, we win!
-
So in these assignments we have learned how to
-
create new game objects,
-
how to position them in the scene,
-
add new components to them,
-
write our own custom behaviours for them
-
using simple scripting.
-
We've seen how to use lights, cameras,
-
colliders, triggers, rigid bodies.
-
We can collect and count objects.
-
Though this is a very simple example
-
it covers a large set of basic
-
subjects important to understanding how to use Unity.
-
For continued learning about Unity
-
check the Learn site for more lessons,
-
assignments and projects.