WEBVTT

00:00:02.220 --> 00:00:06.970
Welcome. Welcome, welcome. All these
heads pop up. How's everybody doing?

00:00:07.690 --> 00:00:10.260
Good, good. That was more people
that answered... than I expected

00:00:10.310 --> 00:00:12.860
to answer at 5:00 at the end of
the day. So thank you very much

00:00:12.910 --> 00:00:16.210
for coming. My name is Adam Tuliper.
I'm a technical evangelist

00:00:16.260 --> 00:00:19.510
with Microsoft working out southern
California. I do a lot on

00:00:19.560 --> 00:00:23.290
the gaming side. I came from an enterprise
background, and about

00:00:23.340 --> 00:00:25.580
two years ago, by accident, somebody
at hack-a-thon mentioned

00:00:25.630 --> 00:00:28.250
something about Unity. Who knows
about the dependency injection

00:00:28.300 --> 00:00:30.600
software, Unity? All right. And
that's what I thought they were

00:00:30.650 --> 00:00:32.610
talking about. I found out there's
this whole game engine out

00:00:32.660 --> 00:00:34.900
there, and then that changed my
career. So things happen in

00:00:34.950 --> 00:00:36.230
kind of a crazy way here.

00:00:37.470 --> 00:00:39.960
Don't forget to submit an evaluation.
That's important to all

00:00:40.010 --> 00:00:41.460
of us, especially myself.

00:00:44.130 --> 00:00:46.720
We're going to be doing an overview
of Unity. How many people

00:00:46.770 --> 00:00:50.910
are using Unity currently? A few folks.
About a third of the folks.

00:00:50.960 --> 00:00:53.430
All right, cool. We'll be doing
an overview. This is not going

00:00:53.480 --> 00:00:55.920
to be an intro to Unity session,
although for the folks that

00:00:55.970 --> 00:00:58.490
haven't touched Unity, I'll touch
on a couple basic points in

00:00:58.540 --> 00:01:00.630
there so you're not totally loss
looking at the enter phase and

00:01:00.680 --> 00:01:01.490
what we're doing.

00:01:02.320 --> 00:01:05.290
Tooling, where moved fits in on
the tooling story with Unity,

00:01:06.080 --> 00:01:08.610
and Universal Windows Apps and the
Universal Windows Platform,

00:01:08.660 --> 00:01:11.920
talk about how we can build for that
from Unity, some cross-device

00:01:11.970 --> 00:01:15.160
strategies, and where we're going.
A little bit of a roadmap.

00:01:17.990 --> 00:01:21.460
So Unity and Visual Studio, my two
favorite software products.

00:01:22.880 --> 00:01:26.370
Unity 5 is the recent version, where
they made some really cool

00:01:26.420 --> 00:01:29.030
announcements outside of feature support.
They changed the licensing

00:01:29.080 --> 00:01:32.600
model on there so if you get the
free version or the pro version,

00:01:32.650 --> 00:01:36.900
they have the same basic feature set.
99.999 are the same feature set.

00:01:36.950 --> 00:01:39.360
Pro gives you some additional cloud-based
services, analytics,

00:01:39.410 --> 00:01:42.570
build, et cetera. Some of my favorite
features, I'll just talk

00:01:42.620 --> 00:01:45.790
about real quick here. Animation.
If you have any sort of character

00:01:45.840 --> 00:01:48.760
in a T pose, for example, let's
say you just have a zombie that

00:01:48.810 --> 00:01:51.320
you bought from the asset store, which
I'll talk about or designer

00:01:51.370 --> 00:01:53.850
created for you, you can take
any animation. Maybe somebody

00:01:53.900 --> 00:01:56.150
is shooting an arrow or somebody
doing a zombie walk or I've

00:01:56.200 --> 00:01:59.250
seen one, literally in a zombie game,
I saw a zombie doing Gangnam

00:01:59.300 --> 00:02:02.610
style dance. You can take those
animations and apply them to

00:02:02.660 --> 00:02:05.420
any other character in a T pose. So
they're retargetable animations.

00:02:05.870 --> 00:02:09.020
The graphics engine was revamped
in Unity 5 so amazing changes

00:02:09.070 --> 00:02:12.570
there to give essentially triple A
quality lighting in your games.

00:02:13.350 --> 00:02:16.880
Optimizing, they've got a profiler
built into Unity as well as

00:02:16.930 --> 00:02:20.370
a frame debugger now as well. The
audio system in Unity was also

00:02:20.420 --> 00:02:24.950
revamped in 5 and now they have
an audio mixer. And 2D and 3D

00:02:25.000 --> 00:02:28.140
physics, they use two very well
known engines out there, and

00:02:28.190 --> 00:02:32.210
there are other products that use
them as well. Box2D and NVIDIA

00:02:32.260 --> 00:02:36.740
PhysX 3.3. That allows you to have
hundreds of physics objects

00:02:36.790 --> 00:02:39.780
in your scenes, things bouncing around,
colliding with each other.

00:02:39.830 --> 00:02:42.460
So very, very high performance now
in Unity 5, things you can't

00:02:42.510 --> 00:02:45.570
do in the prior four versions. From
a scripting standpoint, it

00:02:45.620 --> 00:02:50.080
supports C#, and that's all I care
about. The first the first

00:02:50.710 --> 00:02:53.180
thing I'm going to share is from
a demo that you can see on a

00:02:53.230 --> 00:02:56.360
Unity site called BlackSmith. Triple
A quality, demo they put

00:02:56.410 --> 00:02:58.880
out there. That character is using
their animation system.

00:02:58.930 --> 00:03:02.220
The second time, their global illumination
system, GI, that's

00:03:02.270 --> 00:03:05.790
included now in Unity 5. The third
screen shot is from the profiler.

00:03:05.840 --> 00:03:09.710
You want to look at memory analysis
and draw calls, things like that.

00:03:09.760 --> 00:03:13.420
You can do that inside of Unity.
Lastly, their 2D tools which

00:03:13.470 --> 00:03:15.150
we'll look at a little
bit later on as well.

00:03:18.460 --> 00:03:22.710
Is Unity right for you? And there's
one reason I show this slide.

00:03:22.760 --> 00:03:26.060
Unity has a 45 percent market share.
The next closest competitor,

00:03:26.110 --> 00:03:30.070
17 percent. And I don't want this
to be a sales slide. I want

00:03:30.120 --> 00:03:32.540
it to be from a developer standpoint
when I develop something,

00:03:32.590 --> 00:03:34.640
I want to know there's support out
there for it. There's a large

00:03:34.690 --> 00:03:37.960
community using that particular
product. Millions of developers

00:03:38.010 --> 00:03:40.490
using Unity and almost any question
that you ask, you'll find

00:03:40.540 --> 00:03:43.330
they have a very stack overflow
type format on their forums,

00:03:43.700 --> 00:03:45.710
where people up vote, vote down,
et cetera, and you'll find that

00:03:45.760 --> 00:03:47.870
almost any question you can go
and search on the net, you'll

00:03:47.920 --> 00:03:50.130
find that somebody has already
asked before. If not, there's

00:03:50.180 --> 00:03:51.460
a great community to help you out.

00:03:53.610 --> 00:03:55.480
All right. Let's get
right into a demo.

00:04:04.270 --> 00:04:07.870
And let's not be in presenter mode.
Let's go and duplicate my screen.

00:04:10.080 --> 00:04:11.410
Do jumping jacks when
you can see it.

00:04:12.960 --> 00:04:15.450
All right, yes. I didn't think anybody
was going to move. Thank you.

00:04:16.170 --> 00:04:18.350
All right. So this time we're going
to show you what we're going

00:04:18.400 --> 00:04:20.840
to create and then how we can kind
of piece it together before

00:04:20.890 --> 00:04:23.490
we do other things, like bring
it to the platform. So this is

00:04:23.540 --> 00:04:27.290
a fun game idea I just thought of fairly
recently called Metal Warfare.

00:04:28.360 --> 00:04:30.390
I don't have the voice

00:04:33.970 --> 00:04:36.020
for that. So this is Metal
Warfare. Your tank.

00:04:36.600 --> 00:04:40.000
You're the driver of a tank, and
you can do fun things like shoot

00:04:40.050 --> 00:04:44.550
stuff, come around and run into stuff,
because that's what really

00:04:44.600 --> 00:04:45.610
happens in real life.

00:04:47.890 --> 00:04:49.320
Got some music. Oh, no.

00:04:50.610 --> 00:04:53.120
You get the idea. There's a timer
counting down. You have two

00:04:53.170 --> 00:04:56.090
minutes or it's doom and
a little ammo counter.

00:04:56.770 --> 00:05:01.880
It's a fairly decent looking game,
although from a standpoint,

00:05:01.930 --> 00:05:03.450
it's actually fairly simple.

00:05:04.650 --> 00:05:07.150
And it might look like it's a little
complex so we'll kind of

00:05:07.200 --> 00:05:09.500
deconstruct this a little bit and
see how we can actually build

00:05:09.550 --> 00:05:10.080
this up.

00:05:11.050 --> 00:05:13.810
So to do that, let's start with another
instance of Unity I have

00:05:13.860 --> 00:05:16.530
open here. I'll just show you kind
of the steps I did to get

00:05:16.580 --> 00:05:18.830
here and just a file, new project,

00:05:20.300 --> 00:05:24.290
my Unity demo. Unity supports 2D
and 3D. It is a 3D engine so

00:05:24.340 --> 00:05:27.000
even your 2D games are really a 3D
environment. It's just fixing

00:05:27.050 --> 00:05:29.540
you to access while you're developing,
but you can pop in and

00:05:29.590 --> 00:05:32.850
out of that. So it's very easy to
make a 2.5D game, for example,

00:05:32.900 --> 00:05:34.900
where you mix 3D and
2D in the same game.

00:05:35.800 --> 00:05:36.960
My demo.

00:05:37.890 --> 00:05:41.020
Create the project. But before
we do that, there's also this

00:05:41.070 --> 00:05:43.700
box here. When I first started
Unity development, I wanted to

00:05:43.750 --> 00:05:45.730
check everything off because I
didn't know what they did.

00:05:45.780 --> 00:05:49.950
And don't do that. Don't make that
same mistake. These, think

00:05:50.000 --> 00:05:52.900
of them as a NuGet package, in a sense.
It's pre-packaged functionality.

00:05:52.950 --> 00:05:54.010
You can bring in your game.

00:05:54.790 --> 00:05:58.670
Some get installed by Unity, by
default, right there. You can

00:05:58.720 --> 00:06:00.570
bring them in from anywhere. If you
download stuff from the asset

00:06:00.620 --> 00:06:03.580
store, which I'll show you shortly,
those come down as Unity packages.

00:06:03.630 --> 00:06:05.850
I have a folder where I keep all of
my favorite Unity packages in.

00:06:05.900 --> 00:06:08.610
They're just essentially compressed
files with lots of functionality.

00:06:08.660 --> 00:06:12.870
Could be audio, scripts, images,
3D models, all packaged up in

00:06:12.920 --> 00:06:15.810
these little bundles. So just for
this one, just to show you

00:06:15.860 --> 00:06:18.650
how we started building it out,
checked off environment.

00:06:18.700 --> 00:06:21.480
The environment package brings
in some things like trees.

00:06:21.530 --> 00:06:24.950
Unity 5 now uses a speed tree system.
Awesome tree system also

00:06:25.000 --> 00:06:28.510
used in movies. And brings us some
images that I can use to kind

00:06:28.560 --> 00:06:30.770
of texture my terrain out a little
bit. And that's all I did.

00:06:30.820 --> 00:06:34.100
But just to save time, I will cancel
that out and just show you

00:06:34.150 --> 00:06:36.050
the next step out of there.

00:06:37.380 --> 00:06:40.600
Now, the interface, again, this
is an intro to Unity, but I do

00:06:40.650 --> 00:06:42.440
want to kind of talk about the interface
for some of the folks

00:06:42.490 --> 00:06:45.150
that are new to Unity here. This is
your virtual environment here.

00:06:45.200 --> 00:06:47.470
This is your level. This is your
[Indiscernible]. This is where you're going to

00:06:47.520 --> 00:06:48.920
do your design inside of Unity.

00:06:49.640 --> 00:06:51.930
Think of when you're working on
a form like in a XAML design

00:06:51.980 --> 00:06:55.060
or something, everything here,
this is what's in your scene.

00:06:56.670 --> 00:06:59.220
And over here are the properties
of what's in your scene.

00:06:59.270 --> 00:07:04.090
Now, everything, 99.999 percent of everything
stems from a game object.

00:07:04.140 --> 00:07:07.740
Just like think about system.object
and .NET, right. 99 point...

00:07:07.790 --> 00:07:10.090
say that again for the third time
today, 99.999 percent of things

00:07:10.140 --> 00:07:13.590
in .NET in here from system.object.
Think of a game object as

00:07:13.640 --> 00:07:16.540
a root object for almost everything
else. It has a basic name,

00:07:17.160 --> 00:07:19.830
it has a tag just like in Visual
Studio or when you're doing

00:07:19.880 --> 00:07:22.630
Windows form or XAML development when
you assign a tag to something.

00:07:22.680 --> 00:07:25.140
It's just a text string that you
can use to describe something

00:07:25.190 --> 00:07:26.740
or you can find something by a tag.

00:07:27.660 --> 00:07:30.630
So a name, a tag, and a transform.
Where it is in space.

00:07:31.600 --> 00:07:33.680
You can move things around, rotate
them, scale them, and that

00:07:33.730 --> 00:07:36.660
equates to these buttons on the
toolbar as well. Anything else

00:07:36.710 --> 00:07:39.400
after that are components. Everything
comes to life by components.

00:07:39.450 --> 00:07:43.390
If I look at a light, a light is
nothing more than a game object.

00:07:43.440 --> 00:07:45.910
It's got these properties and it's
got this light component on

00:07:45.960 --> 00:07:49.170
top of there. If I look at a camera,
it's also a game object.

00:07:49.220 --> 00:07:52.040
It has a camera component. That's
what turns it into a camera.

00:07:52.090 --> 00:07:55.220
When you add a script, it gets added
as a component to a game object.

00:07:55.980 --> 00:07:59.030
If I look at a cube, for example,
a cube is a game object.

00:07:59.080 --> 00:08:01.520
It's got a mesh filter. We're just
responsible for reading the

00:08:01.570 --> 00:08:03.860
vertices out of the model and passing
that over to this thing

00:08:03.910 --> 00:08:06.720
called a mesh render, which makes
it visible or invisible.

00:08:07.710 --> 00:08:10.040
You ever see the games where you
have the same visible border

00:08:10.090 --> 00:08:12.420
at the end of your level and you're
like, I wonder how the developers

00:08:12.470 --> 00:08:13.120
did that?

00:08:13.990 --> 00:08:17.110
It's an invisible border. That's
exactly what happens.

00:08:18.340 --> 00:08:20.880
All right. So let's look at some
of the built-in functionality.

00:08:20.930 --> 00:08:24.020
Unity is not a 3D modeling system.
Asterisks because they do

00:08:24.070 --> 00:08:26.590
have some tools built in. You can
do some 3D modeling and there's

00:08:26.640 --> 00:08:28.670
third party tools like Pro Builder,
for example, where you can

00:08:28.720 --> 00:08:30.940
actually do modeling inside of
Unity. But I'll show you one

00:08:30.990 --> 00:08:34.440
of the built-in systems here, since
I use it to build out the game.

00:08:34.490 --> 00:08:37.320
That's the terrain system. I'm
going to create a new terrain

00:08:37.370 --> 00:08:40.110
and it comes out as this plane
here. I want to texture it.

00:08:40.160 --> 00:08:43.330
I want to add an image on to that
terrain. That's what the paint

00:08:43.380 --> 00:08:46.230
brush here is for. So I highlight my terrain.
I get all of its components.

00:08:46.280 --> 00:08:49.200
It's a game object with some other
components here. And I click

00:08:49.250 --> 00:08:52.140
on the paint brush, and I can
add a texture. In other words

00:08:52.190 --> 00:08:54.570
I can take an image and plaster
it all over there. So I'm going

00:08:54.620 --> 00:08:56.490
to add a texture here
and select it.

00:08:57.720 --> 00:09:00.640
And if I search for ground or grass,
there's a couple basic ones

00:09:00.690 --> 00:09:01.390
in this pack.

00:09:03.610 --> 00:09:06.580
First one gets applied, goes all
over the entire surface.

00:09:06.630 --> 00:09:10.730
So you can see it's repeatable. How
do you change that in a real

00:09:10.780 --> 00:09:13.770
world environment? You know, when
we saw this game right here,

00:09:13.820 --> 00:09:15.880
if you get close sometimes, some
things look repeatable.

00:09:15.930 --> 00:09:18.440
But by mixing it up, by overlaying
different textures on top

00:09:18.490 --> 00:09:21.010
of there, you can see I've got some
stand. There's a base texture.

00:09:21.060 --> 00:09:24.030
There's a little bit of a green
texture. So by randomizing your

00:09:24.080 --> 00:09:26.000
terrain, things look a
little bit different.

00:09:27.550 --> 00:09:29.870
Now, we need to sculpt this out.
It's another thing we can do

00:09:29.920 --> 00:09:33.270
with our terrain tools here. The first
one, raise or lower terrain.

00:09:33.320 --> 00:09:35.140
I think this is like my favorite
tool in Unity, because you can

00:09:35.190 --> 00:09:36.440
do cool things like this.

00:09:38.760 --> 00:09:40.000
Start drawing stuff out.

00:09:41.640 --> 00:09:43.350
If you want to paint
something like a

00:09:44.840 --> 00:09:48.880
plateau or mesa, to be specific,
that was a little high.

00:09:50.290 --> 00:09:52.830
Paint those up. You can actually
use another tool in here to

00:09:52.880 --> 00:09:55.350
come in and erode them down a little
bit more. So if some of

00:09:55.400 --> 00:09:59.230
these are very, like, very jagged,
not realistic looking, so

00:09:59.280 --> 00:10:01.140
you can erode those down
a little bit more.

00:10:02.350 --> 00:10:05.410
And as you can raise, so can you
shrink. If I want a little

00:10:05.460 --> 00:10:07.980
pathway for my troops to run through
there or a little canyon

00:10:08.030 --> 00:10:12.090
valley, make a little randomized
not so straight. And just like

00:10:12.140 --> 00:10:14.110
that, we have a basic terrain. Of
course, I would want to take

00:10:14.160 --> 00:10:16.690
other images and plaster it on there.
But that's how you sculpt

00:10:16.740 --> 00:10:19.340
out your terrain, take a bunch of
images, plaster it on top of

00:10:19.390 --> 00:10:22.120
there, and paint it. And you have
your paint brush. You can

00:10:22.170 --> 00:10:25.510
add one or more textures
on there to paint.

00:10:26.140 --> 00:10:29.530
The next thing I did was I
brought in a couple trees.

00:10:30.160 --> 00:10:33.970
And again, Unity uses the speed
tree system so if we search for

00:10:34.020 --> 00:10:37.550
some trees, our environment pack
that we brought in gives us

00:10:37.600 --> 00:10:38.380
a couple trees.

00:10:40.750 --> 00:10:45.150
Add those, and I can paint a big
area. But let's being sparing.

00:10:45.970 --> 00:10:48.300
I'm from California. There's not
much water from California so

00:10:48.350 --> 00:10:51.220
I'm going to be a little sparing
with the trees here.

00:10:53.020 --> 00:10:55.420
You guys are like what happens if you
crank it up and click an area?

00:10:56.420 --> 00:10:58.540
That's what happens. Or my favorite
button of all time, mass

00:10:58.590 --> 00:11:00.660
placed trees. Let's get
a thousand trees.

00:11:01.320 --> 00:11:01.870
There we go.

00:11:02.710 --> 00:11:05.430
So just like that, we can do grass.
We can paint rocks on there.

00:11:05.480 --> 00:11:07.250
We can do all these other
different textures.

00:11:08.330 --> 00:11:10.780
Those are built-in tools in unit.
You saw in the game, we actually

00:11:10.830 --> 00:11:13.960
had more than just that involved.
So that kind of brought me

00:11:14.010 --> 00:11:15.110
over to the asset store.

00:11:15.710 --> 00:11:18.600
I was a software architect for many
years before joining Microsoft,

00:11:18.650 --> 00:11:21.730
and I can draw a mean stick figure
and that's about it. So if

00:11:21.780 --> 00:11:24.740
I want to create a game that looks
somewhat cool, then I go ahead

00:11:24.790 --> 00:11:28.140
and grab stuff from the asset store.
I know a couple designers,

00:11:28.190 --> 00:11:31.350
but most of what I use, I grab
from the asset store. I think

00:11:31.400 --> 00:11:34.220
that's what makes Unity one of the
most powerful marketplaces.

00:11:34.750 --> 00:11:37.440
I work with a lot of game devs, a
lot of indie devs, development

00:11:37.490 --> 00:11:40.730
shops, game shops, and near everybody
I talk to uses something

00:11:40.780 --> 00:11:42.670
from the asset store. They might
not use a zombie from the asset

00:11:42.720 --> 00:11:45.600
store, they might use scripts that
extend Unity's interface,

00:11:46.200 --> 00:11:49.130
but we can grab, you want 3D models
for your game? You want free

00:11:49.180 --> 00:11:51.860
3D models or pay 3D models? Here's
a whole bunch of free ones

00:11:51.910 --> 00:11:54.530
listed there. Zombie female
character pack.

00:11:55.290 --> 00:11:58.020
Download them and you can use them
inside of your game without

00:11:58.070 --> 00:12:00.370
any kind of royalties. The free
ones are free. The pay ones

00:12:00.420 --> 00:12:01.790
you download and use
them in your game.

00:12:01.840 --> 00:12:06.900
Done. You want audio for your game?
Perfect. Free audio, pay audio.

00:12:06.950 --> 00:12:10.620
Very, very high quality assets
on there. And so in making out

00:12:10.670 --> 00:12:13.330
Metal Warfare, the tank game I
showed you in the beginning, I

00:12:13.380 --> 00:12:16.320
grabbed a couple packs off the
asset store. I got some audio.

00:12:16.370 --> 00:12:18.610
I grabbed a tank pack. I actually
grabbed a helicopter pack.

00:12:19.240 --> 00:12:23.250
I grabbed a middle east pack on
there, and that brought me over

00:12:23.300 --> 00:12:24.210
to this.

00:12:26.560 --> 00:12:30.160
So I took that terrain and just kind
of changed that a little bit.

00:12:30.210 --> 00:12:33.860
I brought in some rocks. You can
kind of see here, took a couple

00:12:33.910 --> 00:12:37.400
different images, painted that
up. Now the magic happens in

00:12:37.450 --> 00:12:40.240
the rest of it. So we have
a basic terrain here.

00:12:40.750 --> 00:12:42.370
Some concrete on the side of there.

00:12:43.250 --> 00:12:48.620
Next was taking some of these prefabs,
prefabricated objects

00:12:48.670 --> 00:12:51.220
that you can just take and drop
into your scene. You can make

00:12:51.270 --> 00:12:53.460
your own prefabs in Unity. Literally,
you take something from

00:12:53.510 --> 00:12:55.590
here and you drag it down to there,
and it becomes a prefab,

00:12:55.640 --> 00:12:58.460
and then you can reuse it across
your scenes. These prefabs

00:12:58.510 --> 00:13:00.870
are things that this designer said
hey, I want to give you reusable

00:13:00.920 --> 00:13:05.290
bits of information. So using the
prefabs, and if we want another

00:13:05.340 --> 00:13:07.240
rock, for example, take a rock there.

00:13:07.780 --> 00:13:09.690
Of course, stacking those up side
by side would look a little

00:13:09.740 --> 00:13:13.910
bit goofy so it's all about randomizing.
Placing your environment,

00:13:13.960 --> 00:13:16.410
randomizing your things, scaling
them up, scaling them down a

00:13:16.460 --> 00:13:17.000
little bit.

00:13:17.990 --> 00:13:20.230
Randomize, randomize, randomize.
We've got some rocks there.

00:13:20.280 --> 00:13:23.620
We take... we've got a hangar.

00:13:27.330 --> 00:13:30.030
Couple little guard towers. Bring
those into focus. Look at those.

00:13:30.080 --> 00:13:32.530
Those look all right. And it's
all about just taking kind of

00:13:32.580 --> 00:13:35.090
the minute details in there, right.
We can drag big things around.

00:13:35.140 --> 00:13:38.690
What about little things like fence,
for example, frame that.

00:13:42.330 --> 00:13:47.300
So you get the idea. Take objects, snap
them together, make these environments.

00:13:47.850 --> 00:13:49.290
So that's about what
it looks like there.

00:13:50.180 --> 00:13:52.650
The next step on there was taking
one of the other packs that

00:13:52.700 --> 00:13:53.080
I got

00:13:54.670 --> 00:13:58.450
and prefabs vehicles.

00:14:01.260 --> 00:14:03.110
And to be clear, I did write a little
bit of code around there.

00:14:03.160 --> 00:14:06.250
I didn't quite like the way that it operated.
This physics tank controller.

00:14:06.300 --> 00:14:09.360
So I wanted to change some of the functionality.
It was a first person.

00:14:09.410 --> 00:14:11.910
I wanted to make a little AI into
it. So I did make a little

00:14:11.960 --> 00:14:13.260
bit of code changes on there.

00:14:13.810 --> 00:14:15.320
But it did work out of the box.

00:14:16.190 --> 00:14:19.830
So you can see how this level here
actually looks pretty similar

00:14:19.880 --> 00:14:21.620
to the one that I showed you
in the beginning here.

00:14:29.430 --> 00:14:30.940
That's it. We've got our tank there.

00:14:32.450 --> 00:14:34.510
We've got a helicopter,
also in the asset pack.

00:14:36.930 --> 00:14:40.250
I got a script that actually will
piece apart your meshes, reads

00:14:40.300 --> 00:14:42.250
all your vertices and just destroys
it when you collide with

00:14:42.300 --> 00:14:44.830
it or hit it or do whatever you
want to do. So using all the

00:14:44.880 --> 00:14:47.740
power from the asset store kind
of created a game here. And I

00:14:47.790 --> 00:14:50.340
hired a designer to do a little bit
of work which I'll talk about

00:14:50.390 --> 00:14:51.820
in just a tiny bit here.

00:14:57.090 --> 00:14:58.240
So we've got this game.

00:15:01.560 --> 00:15:04.740
Let's talk about some of the tooling
that we have to make things

00:15:04.790 --> 00:15:08.000
a little bit easier for the game
developer. For somebody using

00:15:08.050 --> 00:15:08.810
Unity here.

00:15:12.770 --> 00:15:16.630
We purchased a company called Syntax
Tree within the last year,

00:15:16.680 --> 00:15:20.640
and they had a product called Unity
VS. And it was to use Unity

00:15:20.690 --> 00:15:24.210
with Visual Studio and it was about
$100 plug-in that you pulled

00:15:24.260 --> 00:15:26.590
into Unity. I know a lot of folks
that loved it, they used it.

00:15:26.640 --> 00:15:29.310
But it also cost a hundred bucks.
So we bought them and we turned

00:15:29.360 --> 00:15:30.780
around and made this product free.

00:15:31.620 --> 00:15:34.640
And this allows you to use Visual
Studio to edit and debug code.

00:15:34.690 --> 00:15:38.360
The default is MonoDevelop. And
who uses Visual Studio, right?

00:15:38.410 --> 00:15:40.460
Probably everybody raised
their hand. Most people.

00:15:41.860 --> 00:15:44.200
So this allows you to use Visual
Studio to not only edit but

00:15:44.250 --> 00:15:47.090
also to debug your code in Unity,
which we'll look at shortly.

00:15:47.980 --> 00:15:50.410
This makes the two integrate
together pretty seamlessly.

00:15:51.880 --> 00:15:54.980
This gives you shade or syntax highlighting,
IntelliSense, like

00:15:55.030 --> 00:15:58.420
you'd expect kind of in an IDE, code
templates, one of my favorite

00:15:58.470 --> 00:16:02.020
features of that and full, full
debugging support. With Unity,

00:16:02.070 --> 00:16:04.570
you can use any text editor that
you want, but you just can't

00:16:04.620 --> 00:16:06.880
debug your code. Out of the box,
it works for mono development.

00:16:06.930 --> 00:16:09.220
This allows you now to use Visual
Studio to debug your code.

00:16:10.940 --> 00:16:14.670
So what happens is a plug-in gets
involved into Visual Studio.

00:16:14.720 --> 00:16:17.920
You install a package into your
game, and the two of them uses

00:16:17.970 --> 00:16:22.160
the existing interfaces that MonoDevelop
uses to talk back and forth.

00:16:22.210 --> 00:16:25.360
There's a soft debugger that Mono
uses, and it allows you to

00:16:25.410 --> 00:16:27.280
talk back and forth between Visual
Studio and Unity. So it uses

00:16:27.330 --> 00:16:30.070
the same underlying mechanism that
MonoDevelop uses as well.

00:16:32.460 --> 00:16:33.490
Anybody hear about this?

00:16:34.220 --> 00:16:35.430
The partnership for tools.

00:16:37.010 --> 00:16:39.390
We've announced that we're working
with Unity and the Visual

00:16:39.440 --> 00:16:43.410
Studio community edition is going
to be an option during install

00:16:43.460 --> 00:16:47.690
for Unity and some other tools as
well where, during setup, click

00:16:47.740 --> 00:16:50.340
click, and you have Visual Studio
community edition as your code

00:16:50.390 --> 00:16:52.730
edit on there. So it's going to work
very seamlessly there as well.

00:16:52.780 --> 00:16:54.930
You can use MonoDevelop as well if
you still want to use MonoDevelop,

00:16:54.980 --> 00:16:57.180
but I'm a Visual Studio guy.

00:16:59.220 --> 00:17:01.360
All right. Let's look at
what that looks like.

00:17:02.720 --> 00:17:04.750
I was excited when this partnership
happened, because I think

00:17:04.800 --> 00:17:06.340
this is one of the coolest tools.

00:17:08.760 --> 00:17:09.890
So to get it,

00:17:12.260 --> 00:17:15.620
you can look for Visual Studio
tools, VST folks call it.

00:17:15.670 --> 00:17:19.990
You can also go to Unityvs.com,
select a version that you want,

00:17:20.600 --> 00:17:23.230
easy as that. Downloads and installs
on your system. The installer

00:17:23.280 --> 00:17:26.210
install as plug-in to Visual Studio
for you and installs an asset

00:17:26.260 --> 00:17:29.410
package, like I was talking about
earlier, a Unity package that

00:17:29.460 --> 00:17:32.020
Unity can see. So let's look
at what that looks like.

00:17:32.810 --> 00:17:35.200
Let's take this basic one
that we did before.

00:17:37.610 --> 00:17:41.400
And under assets import package,
we can always bring in those

00:17:41.450 --> 00:17:43.220
little checkboxes that I showed
you in the beginning, the new

00:17:43.270 --> 00:17:46.020
project dialog. We can always bring
those in later, at any time.

00:17:46.070 --> 00:17:48.810
We can either use these. We can double
click on one in our system.

00:17:48.860 --> 00:17:51.340
We don't have to use these. I just
want to show you that Visual

00:17:51.390 --> 00:17:54.540
Studio tools for Unity installs here
and it gets listed as Visual

00:17:54.590 --> 00:17:58.400
Studio 2015 tools. You click on
that, and it tells you, hey,

00:17:58.450 --> 00:18:01.010
this is what's inside of that Unity
package file. And there's

00:18:01.060 --> 00:18:03.320
just these two libraries
so we import that.

00:18:05.360 --> 00:18:06.140
That's it.

00:18:06.190 --> 00:18:10.100
Done. A new menu appears up here,
generate project files.

00:18:10.150 --> 00:18:13.270
You typically don't have to click
that. This runs just automatic.

00:18:13.320 --> 00:18:15.440
But I will show you another
change that happens here.

00:18:15.490 --> 00:18:17.610
Inside of Unity if you want to
change your text editor or see

00:18:17.660 --> 00:18:21.970
what your code editor is, edit
preferences, external tools.

00:18:22.780 --> 00:18:25.570
The default is MonoDevelop. As soon
as you install this tooling,

00:18:25.620 --> 00:18:28.500
it switches to this file opener,
Unityvs.openfile.

00:18:30.640 --> 00:18:31.510
Close that out.

00:18:33.490 --> 00:18:36.770
Let's go ahead and create
a C# script here.

00:18:38.930 --> 00:18:39.700
We will make...

00:18:40.390 --> 00:18:41.560
let's make an evil cube.

00:18:42.130 --> 00:18:45.160
So I'm going to create a little
class called cube controller.

00:18:45.210 --> 00:18:48.100
Very important to make sure that
your file name matches your

00:18:48.150 --> 00:18:50.190
class name or otherwise
things won't work.

00:18:52.370 --> 00:18:54.440
Double click on it. Visual
Studio opens up.

00:18:59.180 --> 00:19:02.950
All right. There's my new empty
class. Unity gives you a new

00:19:03.000 --> 00:19:06.070
class with two methods built into
it, two very common methods.

00:19:06.120 --> 00:19:08.010
This is probably about seven that
are used on occasion, maybe

00:19:08.060 --> 00:19:12.250
even less. Gives you start and
update. Start gets called.

00:19:12.630 --> 00:19:13.830
The object is starting up.

00:19:19.910 --> 00:19:22.090
Update gets called every frame.
But let's add something more

00:19:22.140 --> 00:19:22.800
into here.

00:19:24.720 --> 00:19:26.720
One of the things that I love and
I use all the time with Visual

00:19:26.770 --> 00:19:30.440
Studio tools for Unity is trying
to remember what these methods

00:19:30.490 --> 00:19:32.880
are in Unity. If I know I want to
detect collision between two

00:19:32.930 --> 00:19:35.800
objects, I know there's an on collision
enter, there's an on

00:19:35.850 --> 00:19:38.610
trigger enter if that object's
a trigger. There's on trigger

00:19:38.660 --> 00:19:42.990
enter 2D if it's a 2D object. On collision
2D if it's a 2D object.

00:19:43.300 --> 00:19:46.150
And the method signature changes time.
There's different parameters

00:19:46.200 --> 00:19:49.460
that get passed in them. So try to
remember the API call sometimes

00:19:49.510 --> 00:19:50.510
is a little difficult.

00:19:51.370 --> 00:19:55.720
So Control-Shift-M brings you up
these helpers that are installed

00:19:55.770 --> 00:19:59.280
by VSTU, and this gives you all
the common Unity methods that

00:19:59.330 --> 00:20:02.660
you will use and it will generate
those method stubs for you.

00:20:02.710 --> 00:20:05.930
So, for example, we'll have two
objects that collide here.

00:20:05.980 --> 00:20:10.560
So if I can see on collision enter
not 2D, on collision enter,

00:20:10.610 --> 00:20:11.550
this guy right there,

00:20:12.820 --> 00:20:14.430
go ahead and insert that.

00:20:19.090 --> 00:20:20.650
And here we have it right there.

00:20:21.200 --> 00:20:23.840
Void on collision enter. Let me
reset my size here. For some

00:20:23.890 --> 00:20:24.490
reason, my

00:20:25.890 --> 00:20:27.890
control seems to be stuck
here. There we go.

00:20:29.370 --> 00:20:32.970
So let's say if this particular game
object, so code is assigned

00:20:33.020 --> 00:20:34.120
to a game object.

00:20:35.760 --> 00:20:40.610
If who we've just collided with,
collision.gameobject....

00:20:41.550 --> 00:20:45.200
we can get IntelliSense here for our
Unity properties or Unity objects.

00:20:46.580 --> 00:20:52.160
So if we've collided with the player,
let's go ahead and just ourself.

00:20:54.780 --> 00:20:59.950
You destroy this game object
in two seconds.

00:21:02.490 --> 00:21:05.670
And we'll set a break point there. So
we're very used to this process.

00:21:05.720 --> 00:21:08.020
Now, notice we don't have to worry
about this. We don't have

00:21:08.070 --> 00:21:09.700
to worry about the debug, the release.

00:21:10.210 --> 00:21:12.790
This has changed, right? We're
used to seeing something like

00:21:12.840 --> 00:21:13.570
debug and

00:21:15.030 --> 00:21:19.030
we can launch an emulator and
all sorts of stuff there.

00:21:19.080 --> 00:21:21.300
Right now, we have attach Unity
or attach Unity in play.

00:21:22.490 --> 00:21:26.130
So if we want to debug this, we would
just click that. I'll show

00:21:26.180 --> 00:21:28.520
you that in one second. We need to
do a little bit more background

00:21:28.570 --> 00:21:31.980
work here. I'm saying if I collide
with a player, destroy.

00:21:32.030 --> 00:21:33.820
Well, we haven't assigned this
code to anything yet. So let's

00:21:33.870 --> 00:21:38.280
just do a real, real basic example here
and I'll create a game object.

00:21:38.330 --> 00:21:39.140
I'll create a cube.

00:21:40.200 --> 00:21:41.930
We'll put that at 111.

00:21:45.450 --> 00:21:49.530
We'll duplicate that cube and move
this guy up so we know he's

00:21:49.580 --> 00:21:50.440
going to fall on him.

00:21:51.340 --> 00:21:55.220
In order to fall, we need to give
an object a rigid body component.

00:21:55.640 --> 00:21:57.950
If you're using Unity, you're very
familiar with that. You want

00:21:58.000 --> 00:22:01.320
to give an object mask and gravity,
you simply give it a rigid body.

00:22:01.840 --> 00:22:03.880
And we'll see it fall now.
The code's not on yet.

00:22:04.630 --> 00:22:07.460
There we go. It falls. Let's
go ahead and take that code.

00:22:09.060 --> 00:22:10.340
Give that to our cubes.

00:22:14.120 --> 00:22:15.530
And let's make the

00:22:16.820 --> 00:22:20.380
top cube the player. It's just a
tag. It's just a string we're

00:22:20.430 --> 00:22:21.320
assigning to it.

00:22:23.980 --> 00:22:27.020
All right, let's go ahead and debug
our code. Attach to Unity.

00:22:29.550 --> 00:22:32.400
All right. We come over here and
let's go ahead and play.

00:22:36.480 --> 00:22:40.600
Boom. As soon as that object collided,
we get thrown into Visual Studio.

00:22:40.650 --> 00:22:44.960
Unity is actually hung up right
now because we're in the middle

00:22:45.010 --> 00:22:47.950
of a debug call right now. So if
we want to continue this, we

00:22:48.000 --> 00:22:50.500
can either just F5 or continue.
Let me move this window down

00:22:50.550 --> 00:22:53.010
so you see. All the same debugging
exists here. If you want

00:22:53.060 --> 00:22:54.790
to see all of your watches,

00:22:56.320 --> 00:22:59.180
if you want to get all of your
helpers here, it all works as

00:22:59.230 --> 00:23:01.630
you'd expect it to work inside
of Visual Studio. So this is

00:23:01.680 --> 00:23:04.280
extremely useful. We'll
say continue.

00:23:05.580 --> 00:23:09.140
After two seconds, there
you go. Destroys itself.

00:23:09.800 --> 00:23:11.530
The other thing that the Visual
Studio tools for Unity gives

00:23:11.580 --> 00:23:16.030
you is shade or syntax highlighting.

00:23:17.990 --> 00:23:20.080
So just a little bit easier on
the eyes if you're writing any

00:23:20.130 --> 00:23:22.490
custom shaders just so get the
syntax highlighting inside of

00:23:22.540 --> 00:23:24.730
your shaders there. So another
nice little feature there.

00:23:25.550 --> 00:23:27.970
When you're done, you just click
stop. You don't have to detach

00:23:28.020 --> 00:23:30.330
from a process or it's not going
to kill Unity. Just click stop

00:23:30.380 --> 00:23:31.670
and you're all done.

00:23:39.070 --> 00:23:42.630
All right. So that was a cool tooling
with Unity. The next thing

00:23:42.680 --> 00:23:47.280
that we have are diagnostics. And
you can use the Visual Studio

00:23:47.330 --> 00:23:49.800
graphics debugger for diagnostics.
Gives you some really low

00:23:49.850 --> 00:23:52.470
level information. Typically, you
want to use this when things

00:23:52.520 --> 00:23:53.930
aren't displaying right and you
need to get to the bottom of

00:23:53.980 --> 00:23:54.730
what's going on.

00:23:55.690 --> 00:23:57.540
This has full Unity support.

00:23:58.770 --> 00:24:01.130
And this will give you the ability
to capture one or multiple

00:24:01.180 --> 00:24:05.230
frames, low level debugging on
there. We'll look at a little

00:24:05.280 --> 00:24:08.360
example of this. But very important
point, this requires Visual

00:24:08.410 --> 00:24:12.250
Studio 2013 CTP5 or above, or it
won't work right with Unity.

00:24:12.300 --> 00:24:14.470
So full Unity support, but make
sure you have the right version

00:24:14.520 --> 00:24:15.690
to be able to support that.

00:24:18.920 --> 00:24:20.220
And let's get right to a demo.

00:24:28.980 --> 00:24:31.270
I have a build that I created
the game. We're going to look

00:24:31.320 --> 00:24:33.950
at the end. It's a cart before
the horse a little bit. I have

00:24:34.000 --> 00:24:35.530
a build that I created before the
game because I want to show

00:24:35.580 --> 00:24:38.650
you the graphics tools here.

00:24:39.360 --> 00:24:43.220
And so what I want to do for this is
show you the various options first.

00:24:43.270 --> 00:24:46.730
We can, under the debug graphics
menu in Visual Studio, debug

00:24:46.780 --> 00:24:49.830
and install that package. So any applications
that you have installed

00:24:49.880 --> 00:24:52.980
locally on your system, you can
debug those. If I bring up that

00:24:53.030 --> 00:24:53.940
list here,

00:24:55.160 --> 00:24:58.960
you'll see all the different store
app packages installed on

00:24:59.010 --> 00:24:59.820
the system.

00:25:00.360 --> 00:25:02.260
And you have a couple different options
if you want to do script

00:25:02.310 --> 00:25:04.980
only, native only, if you only want
to look at the GPU or a mixed

00:25:05.030 --> 00:25:07.980
manage in native and you can
start debugging on that.

00:25:08.590 --> 00:25:11.060
But I actually have a build here
of Metal Warfare. So we're

00:25:11.110 --> 00:25:17.300
going to look at that. And let's go
debug, graphics, start diagnostics.

00:25:19.370 --> 00:25:20.470
Game gets launched.

00:25:21.010 --> 00:25:22.020
Say yes to that.

00:25:24.430 --> 00:25:26.630
Let's try to get it right
when I shoot...

00:25:30.600 --> 00:25:34.290
I'm going to shoot and then use
my touch screen. I'm going to

00:25:34.340 --> 00:25:35.730
scutch thigh screen at
the same time here.

00:25:40.290 --> 00:25:41.580
There you go. Caught that.

00:25:44.480 --> 00:25:48.490
Now a word of warning here. I was
doing some debugging and I

00:25:48.540 --> 00:25:51.240
thought I only captured a couple frames.
I looked at the information

00:25:51.290 --> 00:25:54.250
behind the scenes and I had seven
gigs of data captured so you

00:25:54.300 --> 00:25:57.710
get a lot of data for the low
level diagnostics. So just be

00:25:57.760 --> 00:26:00.720
careful about how long you're going
to be doing captures for.

00:26:02.460 --> 00:26:04.660
You can capture again, as I said,
one our multiple frames.

00:26:04.710 --> 00:26:06.810
I actually have a project loaded
up here that I did with a good

00:26:06.860 --> 00:26:09.370
capture on it that I want to show you
here. Same thing that we're...

00:26:11.040 --> 00:26:15.050
right at the point of impact on
that barracks there, on that

00:26:15.100 --> 00:26:18.210
hangar, I should say, and you can
get all the list of all the

00:26:18.260 --> 00:26:19.290
draw calls here.

00:26:20.130 --> 00:26:21.650
So one of the things when you're
dealing with performance on

00:26:21.700 --> 00:26:25.760
games, as everything gets drawn
out many times a second, and

00:26:25.810 --> 00:26:30.640
the more draw calls that you have
per frame issued, the slower

00:26:30.690 --> 00:26:32.550
that your game is likely
going to run.

00:26:33.680 --> 00:26:36.720
And per each draw call, you can look at
some really low level information.

00:26:36.770 --> 00:26:38.190
What the shader was,

00:26:39.640 --> 00:26:41.910
source code of the shader, et
cetera. But you can also come

00:26:41.960 --> 00:26:42.690
in here and see...

00:26:44.390 --> 00:26:46.080
let's scroll this down
a little bit here.

00:26:47.770 --> 00:26:50.790
If I see that something looks a little
bit weird on a particular

00:26:50.840 --> 00:26:53.680
object in my scene, maybe I have
a pink object coming up, which

00:26:53.730 --> 00:26:56.340
can happen if you have shader issues
or if you just want to see

00:26:56.390 --> 00:26:59.730
how your scene is being composed,
click on a particular pixel

00:26:59.780 --> 00:27:02.650
and for any pixel that you select
in your scene, so let's select

00:27:02.700 --> 00:27:07.740
something here from my HUD element, and
you see kind of its history here.

00:27:07.790 --> 00:27:10.790
For that single pixel on your
screen, gives you its value.

00:27:10.840 --> 00:27:12.350
Tells you the initial color here.

00:27:15.600 --> 00:27:19.630
What happened on this first one here,
so that pixel got written out.

00:27:19.680 --> 00:27:22.370
It's kind of this generic sky there
with a blue color. And at

00:27:22.420 --> 00:27:26.670
some point in time after that,
draw call 40342, that's not in

00:27:26.720 --> 00:27:29.590
a direct number order. There was
not 40,000 draw calls here.

00:27:31.070 --> 00:27:33.190
Now you can see the difference between
the two of them. I have

00:27:33.240 --> 00:27:37.060
no GUI, no HUD element there. And
the very next one, drew that

00:27:37.110 --> 00:27:39.820
image on top of there and you can
see its actual value there.

00:27:39.870 --> 00:27:43.580
Down below, you can see the shader
and what happened on that

00:27:43.630 --> 00:27:45.990
particular element here. Just that
particular element was drawn

00:27:46.040 --> 00:27:49.450
out and you can get even more information
than that. So just

00:27:49.500 --> 00:27:52.380
kind of a quasi high level view
of the information you get with

00:27:52.430 --> 00:27:55.200
that graphics debugger on there.
Very, very easy to launch and

00:27:55.250 --> 00:27:56.420
very, very powerful.

00:27:57.730 --> 00:28:00.500
And it captures a lot of information.
More information than

00:28:00.550 --> 00:28:01.740
you could ever, ever want.

00:28:02.270 --> 00:28:04.730
Or maybe want. You might be
that hard core. All right.

00:28:04.780 --> 00:28:05.930
Let's go back to...

00:28:10.530 --> 00:28:11.960
has anybody used a graphics
debugger yet?

00:28:13.720 --> 00:28:16.390
Couple folks? All right. Are you
using seven gigs of data?

00:28:18.780 --> 00:28:22.650
Tooling recap. Every Unity edition
can use Visual Studio.

00:28:22.700 --> 00:28:24.940
So if you're on Visual Studio...
I'm sorry, if you're on Unity

00:28:24.990 --> 00:28:29.230
4, on Unity 5 and free or professional,
you can use Visual Studio

00:28:29.280 --> 00:28:32.520
tools for Unity and visual studio
community edition or above.

00:28:32.570 --> 00:28:35.070
So if you have a retail version of
Visual Studio, it works fine.

00:28:35.120 --> 00:28:37.320
If you're using Visual Studio Express,
you'll need to upgrade

00:28:37.370 --> 00:28:39.650
that to Visual Studio community edition.

00:28:40.360 --> 00:28:43.120
Control-Shift-M in the Visual Studio
tools for Unity, I think,

00:28:43.170 --> 00:28:45.620
is one of the best things because
I always forget the signatures.

00:28:45.670 --> 00:28:47.550
That gives you all the generated
lists and you can just click

00:28:47.600 --> 00:28:51.490
one and it generates that code
for you. The graphics debugger

00:28:51.540 --> 00:28:54.980
for low level diagnostics, low level
information. Unity actually

00:28:55.030 --> 00:28:59.950
has a... has a version 5, they have
a frame level debugger built

00:29:00.000 --> 00:29:03.950
into Unity. The Visual Studio one here
gives you so much cool information.

00:29:06.760 --> 00:29:09.420
All right. Next let's talk about
the Universal Windows Platform

00:29:09.470 --> 00:29:13.160
or UWP that you guys have probably
heard about 187 times today.

00:29:16.640 --> 00:29:17.810
How do you go from

00:29:19.120 --> 00:29:22.120
your game to all of these
different devices?

00:29:22.720 --> 00:29:25.970
This idea of this universal platform
running on everything in

00:29:26.020 --> 00:29:29.100
the world, how do you take a game
and deliver that there?

00:29:29.150 --> 00:29:31.510
You've got phone, phablets, small tablets,
large tablets, two-in-ones,

00:29:31.560 --> 00:29:35.230
classic laptops, desktop all in
ones, ho lo, Xbox, surface hub,

00:29:35.280 --> 00:29:37.570
and more to come that probably
aren't listed on there.

00:29:37.620 --> 00:29:38.570
There's probably going to be...

00:29:39.230 --> 00:29:41.270
who knows. Crazy stuff down the road.

00:29:41.790 --> 00:29:43.480
Movie screen displays, probably.

00:29:44.520 --> 00:29:46.830
The process is actually pretty
simple to take your game over

00:29:46.880 --> 00:29:47.440
to there.

00:29:48.010 --> 00:29:52.380
And you start with Unity, of course,
and Unity will, in turn,

00:29:52.430 --> 00:29:57.210
export your compiled project
as a Visual Studio solution.

00:29:57.750 --> 00:29:59.830
You open up that Visual Studio solution
and then you, in turn,

00:29:59.880 --> 00:30:02.940
do something with that solution.
The Build process is pretty

00:30:02.990 --> 00:30:04.830
easy so let's go ahead
and look at that.

00:30:17.680 --> 00:30:20.410
Inside of Unity so I've got my
complete scene here. This is

00:30:20.460 --> 00:30:21.890
the one that ran just like this.

00:30:25.020 --> 00:30:28.890
I just like hearing that Cannon.
That's why I keep starting it.

00:30:29.710 --> 00:30:33.010
So I go to build settings, who knows
to build short cut in Visual Studio.

00:30:33.060 --> 00:30:35.090
The same one which makes it really,
really handy for those that

00:30:35.140 --> 00:30:35.720
like shortcuts.

00:30:35.770 --> 00:30:42.420
Control-Shift-B, and inside of here,
we need a scene so there's

00:30:42.470 --> 00:30:44.620
a game that we're working on where
we have, I think, 40 different

00:30:44.670 --> 00:30:48.690
scene files in our project. Some test
ones, ones that test out controllers.

00:30:48.740 --> 00:30:50.860
Do I want all those going in my
final project? No. In this one,

00:30:50.910 --> 00:30:53.610
I only want this particular one
scene. You can either drag and

00:30:53.660 --> 00:30:56.460
drop into there, you can put multiple
ones in there. I'm just

00:30:56.510 --> 00:30:57.980
going to add my current
scene in there.

00:30:59.900 --> 00:31:02.610
And we're going to build for Windows
Store. Now, previously

00:31:02.660 --> 00:31:05.310
if you look at a version that you
don't have access to currently,

00:31:05.580 --> 00:31:08.780
you'll see there's Windows Store
in there, and we can target

00:31:08.830 --> 00:31:13.560
Windows 8, Windows 8.1, we can target
Phone 8.1, and we can target

00:31:13.610 --> 00:31:16.770
Universal 8.1. Of course, you can
see kind of the path going

00:31:16.820 --> 00:31:20.470
this, like this, like this to this
One Store and this one platform.

00:31:21.150 --> 00:31:24.480
And you'll see here pretend for
a moment that the A is a W and

00:31:24.530 --> 00:31:25.560
this actually says UWP.

00:31:26.840 --> 00:31:28.500
Universal Windows Platform.

00:31:30.040 --> 00:31:31.730
You have two different project types
you can select here, XAML

00:31:31.780 --> 00:31:35.390
select direct 3D. I like C# in XAML.
I'm going to choose XAML here.

00:31:36.270 --> 00:31:39.070
This other one is also pretty cool.

00:31:39.710 --> 00:31:43.920
The Unity C# projects, when you do
your build from here to generate

00:31:43.970 --> 00:31:46.640
your Visual Studio solution, it
will take all of your source

00:31:46.690 --> 00:31:50.360
code that you have inside of Unity
and package those up and create

00:31:50.410 --> 00:31:53.100
a separate project for those and
add them as a reference to your

00:31:53.150 --> 00:31:56.340
final game. So you can actually
go and debug your code. One of

00:31:56.390 --> 00:31:58.310
the neat things that we've done
working together with Unity is

00:31:58.360 --> 00:32:01.540
you can actually going into Visual
Studio, close Unity, go into

00:32:01.590 --> 00:32:03.450
Visual Studio, stay oh, you know
what? I don't like that line

00:32:03.500 --> 00:32:06.300
of code. I can make a change. Compile
in Visual Studio. It actually

00:32:06.350 --> 00:32:09.520
calls back off to Unity to recompile
it with certain exceptions.

00:32:09.570 --> 00:32:13.010
You can't make a huge amount of serializable
changes to your class.

00:32:13.550 --> 00:32:16.130
You can make certain code changes
and it will just come back

00:32:16.180 --> 00:32:18.610
and work without having to go through
the whole Build process again.

00:32:19.840 --> 00:32:23.650
So I'm going to build this, and I'm
going to create a new folder.

00:32:23.700 --> 00:32:33.440
Call it demo UWP. There we go. It's
building my assets, my scene.

00:32:34.010 --> 00:32:36.330
They do a lot of work behind the
scenes to take all this stuff

00:32:36.380 --> 00:32:39.000
up and package it so it just works.

00:32:39.620 --> 00:32:42.130
You're not going to get access to
all the low level Unity engine,

00:32:42.180 --> 00:32:44.790
for example. It's not like you're
going to see the source code

00:32:44.840 --> 00:32:47.610
for every single thing going on there.
They package it up nicely

00:32:47.660 --> 00:32:50.370
into this solution. Let's
run that. Metal Warfare.

00:32:53.840 --> 00:32:56.910
There are a couple things to be
aware of. While that's loading,

00:32:57.390 --> 00:33:00.030
let me come back here to Unity.
From a player settings,

00:33:01.240 --> 00:33:04.700
you have a couple different ways
of specifying the details that

00:33:04.750 --> 00:33:08.650
get pushed down to your package.APPX
manifest file. So that's

00:33:08.700 --> 00:33:12.000
the settings that has your capabilities,
tells what your image

00:33:12.050 --> 00:33:15.530
assets are, your splash screen,
your icon, your wide icon you,

00:33:15.580 --> 00:33:18.660
medium icon, your small icon, all
that kind of stuff specified

00:33:18.710 --> 00:33:21.730
in your package.APPX manifest file.
Now, you can go into Visual

00:33:21.780 --> 00:33:25.280
Studio side and set those if you
want, or you can do it on the

00:33:25.330 --> 00:33:27.060
Unity side, and that's what
all these are for.

00:33:27.810 --> 00:33:29.920
Right here, there's your
flash screen image.

00:33:30.570 --> 00:33:32.630
If you want to set the various
icons, you can do it here.

00:33:32.680 --> 00:33:35.430
And all that does is pushes it down
into Visual Studio project,

00:33:35.480 --> 00:33:38.320
the first time you build it. Repeated
builds will not override it.

00:33:38.370 --> 00:33:40.860
So just a word of caution that if
you come in and change it and

00:33:40.910 --> 00:33:46.190
build again, unless you delete that
folder, it won't override it.

00:33:46.240 --> 00:33:49.010
So we've done our builds.
Here we have it.

00:33:53.480 --> 00:33:54.930
There's a couple options here.

00:33:55.720 --> 00:33:59.850
ARM and x86. Now, notice this project
opened up by default with ARM.

00:34:00.730 --> 00:34:03.060
Clearly, I'm not running on an
ARM system here. I'm running

00:34:03.110 --> 00:34:05.620
on an x86 base system. So I'm
going to change that to x86.

00:34:06.940 --> 00:34:09.610
When would I choose ARM? If I'm
going to deploy it to a phone,

00:34:09.660 --> 00:34:10.870
then I would be choosing ARM.

00:34:13.010 --> 00:34:15.640
Debug, master, and release. Now
think about in Visual Studio

00:34:15.690 --> 00:34:18.360
typically for .NET projects, how
many build settings do we have?

00:34:19.490 --> 00:34:22.150
We have... configurations, I should
say. Two types, right.

00:34:22.200 --> 00:34:25.320
We have debug and release. Release
is production. Ship it.

00:34:25.370 --> 00:34:28.960
Debug is debug, not optimize. Well,
now we have three for our

00:34:29.010 --> 00:34:31.290
Unity projects, and each serve
a good purpose. Debug is, of

00:34:31.340 --> 00:34:32.480
course, not optimized.

00:34:33.010 --> 00:34:36.240
Supports the Unity's profiler and
not optimized. The next level

00:34:36.290 --> 00:34:39.490
up is release. Release is in the middle,
not at the top on this one.

00:34:39.540 --> 00:34:44.720
And release is optimized, but it
also supports Unity's profiler.

00:34:44.770 --> 00:34:48.350
And master is a fully optimized,
doesn't support the profiler.

00:34:48.400 --> 00:34:50.230
That's the build that gets shipped
out. That's the one that's

00:34:50.280 --> 00:34:51.870
going to go to your customers. That's
had the one you're going

00:34:51.920 --> 00:34:55.470
to ideally upload to the store, fully
optimized, no profiler support.

00:34:56.500 --> 00:35:00.160
Master, when you're dealing with
Universal Windows Apps, that's

00:35:00.210 --> 00:35:04.150
going to, as its last pass, do a .NET
Native compilation on there.

00:35:04.200 --> 00:35:07.200
So process as of right now, the bits
I have, can take a little bit.

00:35:07.250 --> 00:35:09.750
So I'm going to show you... we're going
to do a release build today.

00:35:09.800 --> 00:35:11.370
Again, remember, that's
that middle build.

00:35:14.670 --> 00:35:15.780
Let's go ahead and run that.

00:35:19.760 --> 00:35:22.670
While that's compiling, you see
over here this data folder.

00:35:23.350 --> 00:35:26.680
That is what Unity will overwrite
every time. So repeat builds

00:35:26.730 --> 00:35:29.610
from Unity and pushing it down to
Visual Studio just overwrites

00:35:29.660 --> 00:35:31.070
their own data folder.

00:35:31.740 --> 00:35:33.600
So if I have my own custom source
code there, maybe I want to

00:35:33.650 --> 00:35:35.560
do my own in-app purchases and write
my own native code there,

00:35:35.610 --> 00:35:38.890
I can do it that way. There
we go. So I've got my game.

00:35:41.480 --> 00:35:42.990
It's running actually pretty good.

00:35:45.980 --> 00:35:53.480
I just want to hear it again. Cool.
Scales. The default apps

00:35:53.530 --> 00:35:56.480
for your Universal Windows Apps will
open up in a windowed environment

00:35:56.530 --> 00:35:58.340
like this which, to me, I think
just looks better, especially

00:35:58.390 --> 00:35:59.620
from a game standpoint here.

00:36:00.790 --> 00:36:02.860
Just keep in mind that users can
do this. They can come in here

00:36:02.910 --> 00:36:05.850
and resize the applications. They
can scale this. So keep this

00:36:05.900 --> 00:36:08.110
in mind and we're going to
touch upon this shortly.

00:36:09.020 --> 00:36:12.840
All right. One more
time. OK.

00:36:12.890 --> 00:36:17.880
Cool. So that's the point to a
local machine. Now if you are

00:36:19.010 --> 00:36:21.630
in the mood to run things slowly,
you can run your game inside

00:36:21.680 --> 00:36:24.090
of an emulator. I don't recommend
doing that. I always recommend

00:36:24.140 --> 00:36:26.990
testing on as much physical hardware
as you can. If you want

00:36:27.040 --> 00:36:29.990
to deploy out to a phone, for example,
you switch the device,

00:36:30.040 --> 00:36:33.170
plug a phone in, change the ARM
and run it and it deploys it

00:36:33.220 --> 00:36:34.480
out to your Windows Phone.

00:36:38.300 --> 00:36:41.030
You can run in a simulator. Remember,
the simulator is not an emulator.

00:36:41.080 --> 00:36:43.820
It's a simulator. So if you want
to check out different pixel

00:36:43.870 --> 00:36:46.460
density displays, you want to fake
a 26-inch display and see

00:36:46.510 --> 00:36:48.900
how your game looks, you can do
that inside of the simulator.

00:36:49.270 --> 00:36:51.830
You can test out some of this inside
of Unity, and we'll look

00:36:51.880 --> 00:36:54.390
at that kind of in the next section
when we talk about the UI,

00:36:54.440 --> 00:36:57.170
but really, it's really, really important
to test out on different

00:36:57.220 --> 00:37:01.510
display sizes, use a simulator, scale
things out. We were working

00:37:01.560 --> 00:37:04.470
on a game once and there's a software
that actually takes screen

00:37:04.520 --> 00:37:06.730
shots running at all these different
resolutions. And what I

00:37:06.780 --> 00:37:09.380
thought looked good on my system
works on my machine, man, it

00:37:09.430 --> 00:37:11.430
looked awful on about 90 percent
of the other resolutions.

00:37:11.480 --> 00:37:13.980
So definitely test that out.

00:37:17.000 --> 00:37:17.960
All righty.

00:37:22.450 --> 00:37:26.510
So thinking about other devices
here, talking about Phone and

00:37:26.560 --> 00:37:30.990
going to desktop, we have to consider
cross-device strategies.

00:37:31.040 --> 00:37:35.580
There's a couple different ways
to do this. But we are in an

00:37:35.630 --> 00:37:38.830
era now where you want to take
one build, or you can take one

00:37:38.880 --> 00:37:41.280
build and run it on a variety of
devices. From a development

00:37:41.330 --> 00:37:43.430
standpoint sometimes it's a lot
easier to do that than have to

00:37:43.480 --> 00:37:45.790
do separate build here, separate
build there, separate build

00:37:45.840 --> 00:37:47.360
there, separate build there.

00:37:49.920 --> 00:37:52.650
The first thing you want to look at
is designing for different screens.

00:37:52.700 --> 00:37:55.000
And there's tooling that's built
inside of Unity that can help

00:37:55.050 --> 00:37:56.870
you handle this. So multiple resolutions.

00:37:57.950 --> 00:38:00.820
Different aspect ratios. Different
device capabilities you're

00:38:00.870 --> 00:38:04.920
going to run across. Screen resizing.
So when we ran the game

00:38:04.970 --> 00:38:08.470
just a minute ago, you saw that I
took that window and dragged it.

00:38:08.520 --> 00:38:11.610
Expect that users are not going to run
it necessarily fixed aspect ratio.

00:38:11.660 --> 00:38:13.560
They're going to run it full screen.
They might window it.

00:38:13.610 --> 00:38:15.490
That's up to the user to control.

00:38:16.480 --> 00:38:18.860
So we can use a couple things built
in Unity for this right now,

00:38:18.910 --> 00:38:21.060
and we're working with them on
iterating on going forward on

00:38:21.110 --> 00:38:24.900
some cool techniques here, so Unity
UI, which I'll show you a

00:38:24.950 --> 00:38:28.070
demo of in a second, is one way of
doing this. Formerly called UGUI.

00:38:28.120 --> 00:38:31.270
If you ever heard of UGUI, it's now
called Unity UI, user interface.

00:38:31.530 --> 00:38:34.410
Another technique you can use
are called asset bundles.

00:38:34.680 --> 00:38:37.300
Asset bundles require a little bit
more work to set up. But if

00:38:37.350 --> 00:38:40.510
you have, for example, a high definition
tank that you want on

00:38:40.560 --> 00:38:44.300
the Xbox and a low definition tank
that you want on mobile, for

00:38:44.350 --> 00:38:47.850
example, you basically assign them
to different asset bundles.

00:38:47.900 --> 00:38:50.190
A high def one and
a low def one, and

00:38:51.410 --> 00:38:53.380
at runtime, when your app loads,
you pull them down from the

00:38:53.430 --> 00:38:55.180
internet or stream them
from some source.

00:38:56.190 --> 00:38:58.760
The infrastructure is built in Unity
to load those packages up.

00:38:58.810 --> 00:39:00.350
So that's one technique
of doing that.

00:39:00.930 --> 00:39:06.810
Another one is using a UI system
to target multi-screen layouts.

00:39:06.860 --> 00:39:09.880
So let's look at what I did
here for Metal Warfare.

00:39:15.670 --> 00:39:19.080
So there's kind of the basic HUD, heads-up
display that was designed there.

00:39:19.750 --> 00:39:21.640
Let's come into a level here
that doesn't have it.

00:39:21.690 --> 00:39:23.720
Basically duplicated that
one and took it back out.

00:39:26.230 --> 00:39:29.390
I talked to a designer, and I said,
hey, we're working on a tank game.

00:39:29.440 --> 00:39:31.930
What is your awesome artistic vision
because I can do stick figures.

00:39:31.980 --> 00:39:34.340
You do better than me. So what can
you come up with? He's like

00:39:34.390 --> 00:39:36.180
how's this? I said that looks great,
so much better than I can do.

00:39:36.230 --> 00:39:38.290
So he gave me the assets for that.

00:39:39.150 --> 00:39:40.240
All these separate ones.

00:39:40.820 --> 00:39:42.990
And I brought them into
my project folder here.

00:39:44.220 --> 00:39:47.530
If I want to take this guy and drag
it at my scene, you notice

00:39:47.580 --> 00:39:50.000
it doesn't work quite like that.
There's this 2D mode inside

00:39:50.050 --> 00:39:50.610
of Unity.

00:39:52.200 --> 00:39:54.980
Underneath our game object menu UI,
we can create all these different

00:39:55.030 --> 00:39:57.390
elements that we've been able to
do. If you want to make the

00:39:57.440 --> 00:40:01.510
comparison to Visual Studio, right.
Panel, buttons, texts, images,

00:40:01.560 --> 00:40:04.030
slider, scroll bar. So all these
different components you would

00:40:04.080 --> 00:40:06.870
think of, these different UI elements,
you can do a lot of these

00:40:06.920 --> 00:40:09.310
inside of Unity and you can create
your own custom one.

00:40:09.360 --> 00:40:11.490
This system is an open source
system. You can find the code

00:40:11.540 --> 00:40:12.270
for it out on the net.

00:40:13.970 --> 00:40:17.430
So let's go ahead and do an image.
Now, clearly, that's not

00:40:17.480 --> 00:40:20.140
what I want, because if I look at
that, that image is plastered.

00:40:20.190 --> 00:40:23.320
Great, I have a heads-up display.
Ship it. It's done. But that's

00:40:23.370 --> 00:40:26.180
not what I want at all. On that
particular image itself, I'm

00:40:26.230 --> 00:40:29.770
going to take that top left image,
bring it over here, and drop

00:40:29.820 --> 00:40:31.440
that guy on there.

00:40:32.700 --> 00:40:35.580
And I need to preserve my aspect
ratio, because that's not what

00:40:35.630 --> 00:40:37.960
I want there. Preserve
my aspect ratio.

00:40:38.910 --> 00:40:42.560
So the thing I can do, if you notice
this box surrounding my

00:40:42.610 --> 00:40:46.140
screen here this is representative
of the current screen I'm on.

00:40:46.190 --> 00:40:50.710
Notice as I change my Windows size,
that changes. So think of

00:40:50.760 --> 00:40:54.790
that as the box that's going to define
the resolution, the size,

00:40:54.840 --> 00:40:57.080
the aspect ratio of whatever system
you're running on, whether

00:40:57.130 --> 00:40:58.900
it's a phone or like this system.

00:40:59.620 --> 00:41:01.440
So this is a good way to test it
out. You can actually scale

00:41:01.490 --> 00:41:03.840
it here and see how that changes.
So if I bring this guy up

00:41:03.890 --> 00:41:07.320
on the top left, this was my top
left HUD element, and I go to

00:41:07.370 --> 00:41:10.020
my game tab here to see what that
would look like, based on its

00:41:10.070 --> 00:41:10.850
first frame,

00:41:12.940 --> 00:41:16.790
as I start scaling, notice that's not
what I want. This thing disappears.

00:41:17.230 --> 00:41:19.500
And I can see what's happening
here if I go to the side.

00:41:20.300 --> 00:41:23.040
It's actually just getting pushed
off. That's because its anchor

00:41:23.090 --> 00:41:25.670
point is in the center of the screen.
So everything it's doing

00:41:25.720 --> 00:41:27.870
is relative to that point. It's
basically saying oh, I'm fixed

00:41:27.920 --> 00:41:30.200
over there. You want me to move
over? I'm going to stay fixed

00:41:30.250 --> 00:41:30.820
to that.

00:41:31.430 --> 00:41:33.650
Just like we can in Visual Studio,
we can anchor a different

00:41:33.700 --> 00:41:36.290
UI element around. We can do the
same thing inside of Unity,

00:41:36.340 --> 00:41:39.410
and that's what this guy's for over
here. Rather than transform,

00:41:39.790 --> 00:41:42.950
our 2D objects have a wrecked transform
object. And on our wrecked

00:41:43.000 --> 00:41:46.380
transform, this little dropdown,
we get docking options that

00:41:46.430 --> 00:41:48.870
kind of reminded me of what I would
do with buttons inside of

00:41:48.920 --> 00:41:49.890
Visual Studio.

00:41:50.450 --> 00:41:53.340
So if I want to dock to the top
left, this will move it to the

00:41:53.390 --> 00:41:57.000
top left and anchor it for me. So
I can hold down shift and alt,

00:41:58.080 --> 00:42:01.050
move it to the top left. I can see
that my anchor point is now

00:42:01.100 --> 00:42:01.750
up there.

00:42:02.470 --> 00:42:04.450
So if I look at my game
and I scale this out,

00:42:06.270 --> 00:42:09.200
you can see that image stays the
same size. It's not getting

00:42:09.250 --> 00:42:11.660
smaller, but it's also not getting
pushed off the side of the

00:42:11.710 --> 00:42:12.720
screen anymore.

00:42:13.450 --> 00:42:16.830
And so easy, easy way to handle
that is I take my anchor point,

00:42:16.880 --> 00:42:19.400
which is actually four points. They
look bundled up there into

00:42:19.450 --> 00:42:22.690
one, and I can just bring them around
to the edge of my object,

00:42:23.070 --> 00:42:23.700
like that,

00:42:27.990 --> 00:42:31.460
and now I'm saying you're anchoring
these four corners, essentially

00:42:31.510 --> 00:42:34.290
pinning it there. And that's going
to be relative to how I'm

00:42:34.340 --> 00:42:39.060
scaling the screen out. So notice, as
I get smaller, it scales smaller.

00:42:39.110 --> 00:42:41.190
I can do the same thing with
text boxes on there.

00:42:41.860 --> 00:42:45.290
Sometimes I want default anchoring
positions. So that top middle

00:42:45.340 --> 00:42:50.140
one that we did here, let's take
a new image here, game object,

00:42:50.190 --> 00:42:51.230
UI, image.

00:42:51.850 --> 00:42:54.210
And give it that top middle.

00:42:54.800 --> 00:42:58.620
Set the aspect ratio. I'm going
to dock this to top middle.

00:42:59.390 --> 00:43:02.000
Well, just so happens that because
it's in the top middle there,

00:43:02.700 --> 00:43:06.680
and its anchor is right there, I
kind of like that. That works

00:43:06.730 --> 00:43:07.340
all right.

00:43:09.830 --> 00:43:12.630
Now, of course, it not changing
size. So I would probably want

00:43:12.680 --> 00:43:15.350
to bring this out here to the edges.

00:43:16.380 --> 00:43:18.940
Not to the edge. Again you, can do
this with all the UI elements.

00:43:18.990 --> 00:43:21.130
You get the idea. It's just
two elements here.

00:43:21.900 --> 00:43:26.020
Fully scales out and so easiest way to
deal with multi-device resolution.

00:43:26.410 --> 00:43:29.080
Pin your objects, test it out. Unity
gives you some helpers right

00:43:29.130 --> 00:43:31.790
in here and there's some pretty cool
stuff available in the Unity

00:43:31.840 --> 00:43:34.490
asset store as well that will actually
set a whole bunch of these

00:43:34.540 --> 00:43:37.400
for you and take screen shots for
you at all different resolutions

00:43:37.450 --> 00:43:40.360
and show you a gallery. This is what
it looks like across 50 devices.

00:43:41.240 --> 00:43:43.950
You can test in some basic aspect
ratios here. So I can see

00:43:44.000 --> 00:43:45.690
what it looks like on a 16 by 9

00:43:47.060 --> 00:43:48.110
or 4 by 3.

00:43:48.920 --> 00:43:50.180
And you can add your own on there.
If you're working with a

00:43:50.230 --> 00:43:52.280
particular device and you want
to add your own resolution on

00:43:52.330 --> 00:43:54.990
there or your own aspect ratio,
you can do that as well.

00:43:55.040 --> 00:44:06.990
Very easy to set up. All right.
Next, sharing code.

00:44:08.510 --> 00:44:13.070
When you have platform-specific
code that you want to run this

00:44:13.120 --> 00:44:16.380
way on one platform and this way
on a different platform, you

00:44:16.430 --> 00:44:19.360
can use preprocessor directives
inside of Unity. There are a

00:44:19.410 --> 00:44:22.840
whole bunch of them that are built
in. This one would say if

00:44:22.890 --> 00:44:25.560
I'm building for Unity, the name
hasn't been changed yet here

00:44:25.610 --> 00:44:29.290
so Unity UAP, imagine for me that
A is a W, that's UWP, so if

00:44:29.340 --> 00:44:32.820
we're building currently for UWP
and I'm not running in Unity's

00:44:32.870 --> 00:44:36.820
editor, then go ahead and compile
that bit of code into there.

00:44:37.600 --> 00:44:40.030
And we can take that a step further.
You'll see that very, very

00:44:40.080 --> 00:44:43.210
common inside of Unity projects. Folks
will target all different platforms.

00:44:43.890 --> 00:44:46.720
I want to do in-app purchases on
iOS here using that. I want

00:44:46.770 --> 00:44:49.500
to do Android over here. I want to
do Windows over here. So this

00:44:49.550 --> 00:44:51.910
is very, very common to see this
type of code inside of Unity.

00:44:52.880 --> 00:44:55.330
Another thing you can do is you
can write plug-ins. You can

00:44:55.380 --> 00:44:58.670
do this before they change a plug-in
model in Unity 5. And I'll

00:44:58.720 --> 00:45:02.590
show you that in a second. But from
a high level standpoint here,

00:45:02.640 --> 00:45:05.790
you have two libraries. You have
one that has your functionality

00:45:05.840 --> 00:45:08.790
built into it. That has your API
that's going to be used.

00:45:08.840 --> 00:45:12.700
When Unity builds your Visual Studio
project, it loops that guy in.

00:45:13.360 --> 00:45:16.200
When you are running inside of Unity,
Unity is an environment,

00:45:16.250 --> 00:45:20.190
it's a virtual environment that
runs mono. Mono, not .NET for

00:45:20.240 --> 00:45:24.160
Windows Store, different requirements,
different API, so you

00:45:24.210 --> 00:45:26.300
need to say that, hey, what you're
compiling for Windows Store,

00:45:26.350 --> 00:45:29.910
I want you to use this library.
And when you're running inside

00:45:29.960 --> 00:45:33.140
of Unity's editor, you're going
to use this stub library that

00:45:33.190 --> 00:45:35.460
has, you know, some fake function
calls in there or however you

00:45:35.510 --> 00:45:38.100
want it to act in Unity's editor.
That's a second library.

00:45:38.150 --> 00:45:39.180
So two libraries.

00:45:40.690 --> 00:45:43.150
And inside of Unity itself, you
have settings that basically

00:45:43.200 --> 00:45:45.530
say hey, when you compile use this
library. When you're running

00:45:45.580 --> 00:45:47.970
in the editor, use this one. Let's
look at what that actually

00:45:48.020 --> 00:45:48.920
looks like here.

00:45:56.090 --> 00:46:00.020
This is a real, real basic example.
I have two projects I generated.

00:46:01.240 --> 00:46:02.880
One, I did a file

00:46:04.230 --> 00:46:07.980
new project. On that new project,
I specified that this was a

00:46:08.030 --> 00:46:11.300
Windows universal class library.
So it's going to understand

00:46:11.350 --> 00:46:13.660
that code and that namespace

00:46:15.040 --> 00:46:16.480
and compile a particular way.

00:46:17.270 --> 00:46:19.920
Again, that does not work inside
of Unity's editor. Unity runs

00:46:19.970 --> 00:46:22.930
on a particular version of Mono inside
your own little virtual environment.

00:46:23.180 --> 00:46:26.280
Secondly, I have a stub library.
And this particular library

00:46:26.330 --> 00:46:31.740
here, if we look at, this is a .NET
framework 3.5. So that has

00:46:31.790 --> 00:46:35.480
the same API compatibility with what's
running inside of Unity's editor.

00:46:35.530 --> 00:46:39.250
This is my stub library. This
is what I have my... the code

00:46:39.300 --> 00:46:41.210
that's just going to fake something
out for me. How do I fake

00:46:41.260 --> 00:46:41.680
it out?

00:46:42.560 --> 00:46:46.550
Real easy way of doing this is you share
your code between these projects.

00:46:47.630 --> 00:46:48.800
If you've ever seen this,

00:46:50.250 --> 00:46:51.260
if I say add

00:46:53.010 --> 00:46:58.280
an existing item and I point to a
C# file, if you're not familiar

00:46:58.330 --> 00:47:01.790
with this, add is link. You add
a source code project, a file

00:47:01.840 --> 00:47:04.520
to your project, but it doesn't
copy into your project. It just

00:47:04.570 --> 00:47:07.680
links to it somewhere else. If
there's any web developers in

00:47:07.730 --> 00:47:09.530
here, you'll see this extensively
throughout the embassy source

00:47:09.580 --> 00:47:12.190
code, for example. It's actually
the first place I ever saw it.

00:47:12.240 --> 00:47:15.740
So you add it as a link. And the
cool thing that happens is when

00:47:15.790 --> 00:47:19.280
I compile here, for my Windows
universal library,

00:47:20.630 --> 00:47:21.450
this is true.

00:47:22.010 --> 00:47:24.810
How do I know it's true? Well, easy enough,
I just look at my properties.

00:47:26.390 --> 00:47:29.070
And I can see, oh, here's my conditional
compilation symbols,

00:47:29.120 --> 00:47:31.260
net FX core and Windows UAP.

00:47:32.590 --> 00:47:35.350
So I know that's true. So when
I compile this, this IRS going

00:47:35.400 --> 00:47:35.960
to work.

00:47:36.580 --> 00:47:40.370
And I'm asking the new API, hey, is
this particular contract present?

00:47:41.130 --> 00:47:44.270
Universal window apps operate
on this idea of contracts.

00:47:44.320 --> 00:47:47.790
Hey, is this contract present on the
system? And I'm asking for that.

00:47:47.840 --> 00:47:51.050
Is this a phone? Do you support
this phone contract? Well, this

00:47:51.100 --> 00:47:54.520
other stub library, running inside
of Unity's editor, has no

00:47:54.570 --> 00:47:58.200
idea what this is. So if I look
at that code, you can see the

00:47:58.250 --> 00:48:01.070
icon's a little bit different
here. It's a linked C# file.

00:48:01.930 --> 00:48:04.760
This is no longer true. This project
doesn't know anything about it.

00:48:04.810 --> 00:48:07.330
So when I compile, it's going
to comment that out.

00:48:08.300 --> 00:48:10.380
So I take those two libraries,
I drag them I bring them over

00:48:10.430 --> 00:48:11.050
into Unity.

00:48:11.710 --> 00:48:14.180
Inside of Unity here, I go to plug-ins.

00:48:15.750 --> 00:48:18.270
And in the new system, you can put them
in a bunch of different locations.

00:48:18.320 --> 00:48:20.890
I just like to have a plug-ins
folder because I'm old school.

00:48:22.220 --> 00:48:24.990
And I highlight the library I just
dragged and dropped in here,

00:48:25.040 --> 00:48:28.510
platformtools.dll, and I can specify,
hey, this particular version

00:48:28.560 --> 00:48:32.420
is going to be used only when you
compile for Windows Store apps.

00:48:33.190 --> 00:48:36.030
Or this is the stub library, and
you're going to use this when

00:48:36.080 --> 00:48:37.690
somebody comes in the editor
and clicks play.

00:48:38.290 --> 00:48:41.120
So you specify which platform you
want to be used for, and Unity

00:48:41.170 --> 00:48:43.800
will smartly pull it in at
the time when it needs it.

00:48:44.790 --> 00:48:47.810
Any source code changes you make
behind the scene, Unity will

00:48:47.860 --> 00:48:50.350
compile for you automatically. So
when you click on play right

00:48:50.400 --> 00:48:53.040
here, Unity has already grabbed your
source code and compiled it.

00:48:53.090 --> 00:48:56.590
It's not a manual step. It just
happens automatically. So the

00:48:56.640 --> 00:48:59.080
same principle happens here. You
check these off and this just

00:48:59.130 --> 00:49:00.520
happens automatically.

00:49:01.550 --> 00:49:02.240
Pretty cool, right?

00:49:02.290 --> 00:49:12.610
Right. All right. Next, a high level detail
of where are we going. How? When?

00:49:13.130 --> 00:49:16.500
What? The stuff that you're seeing
now is going to be targeted

00:49:16.550 --> 00:49:19.490
in Unity 5.2. 5.2 is not out yet.

00:49:20.460 --> 00:49:23.560
Unity's working hard at making that
available in the coming months.

00:49:24.740 --> 00:49:30.060
Remember that Unity Pro licenses,
so free and pro from a software

00:49:30.110 --> 00:49:33.220
feature set are basically the
same level as each other.

00:49:33.270 --> 00:49:35.450
Unity Pro you get these additional
cloud services, analytics,

00:49:35.500 --> 00:49:38.250
et cetera, but you also get access
to beta versions when they

00:49:38.300 --> 00:49:40.450
become available. This one's not
available yet. They're working

00:49:40.500 --> 00:49:42.330
hard to make this available
in the coming months.

00:49:44.730 --> 00:49:48.910
That's going to target Windows 10
with our One Store. That store

00:49:48.960 --> 00:49:50.900
is going to have various device
families in there. You're going

00:49:50.950 --> 00:49:52.990
to be able to target everything.
You're going to be able to

00:49:53.040 --> 00:49:59.750
target mobile, desktop, Xbox. You
can target all with one package

00:49:59.800 --> 00:50:02.650
or multiple packages as the same
app. So the options are going

00:50:02.700 --> 00:50:05.290
to be there for you, as a developer,
to do it however you want

00:50:05.340 --> 00:50:07.360
to target. One or individual.

00:50:09.590 --> 00:50:15.790
What else runs Windows 10? Hololens.
No, I don't have a Hololens here.

00:50:18.430 --> 00:50:19.280
This is cool.

00:50:20.010 --> 00:50:22.790
Because there is currently, this
was announced on Unity's blog

00:50:22.840 --> 00:50:25.550
this morning so this is public information
now, announcing support

00:50:25.600 --> 00:50:30.550
for Microsoft Hololens. There
is going to be a Unity SDK.

00:50:30.600 --> 00:50:33.220
The team is working very
hard, very awesome on.

00:50:33.920 --> 00:50:35.430
It's going to integrate right with
Unity, you're going to be

00:50:35.480 --> 00:50:38.610
able to do some really cool stuff from
Unity, deploying out to Hololens.

00:50:38.660 --> 00:50:40.780
So stay tuned for information
on that.

00:50:42.170 --> 00:50:45.200
Now, building Windows 10 games,
remember that Universal Windows

00:50:45.250 --> 00:50:49.330
Platform and Universal Windows Apps,
they allow a single package.

00:50:49.380 --> 00:50:52.600
They are a single package. You can target
one or you can target multiple.

00:50:52.650 --> 00:50:55.540
It's up to you as a developer.
The bits you're going to want

00:50:55.590 --> 00:50:57.140
to look for are coming in Unity 5.2.

00:50:57.870 --> 00:51:00.250
Write your game and ensure that
you're doing testing using all

00:51:00.300 --> 00:51:03.770
those different resolutions. Go
into Visual Studio, run it in

00:51:03.820 --> 00:51:07.490
a simulator, run it on different
devices. I like to use Unity,

00:51:07.540 --> 00:51:10.360
even before I get to there, and
just change my aspect ratios,

00:51:10.770 --> 00:51:12.640
set it all up inside of Unity,
see what it looks like. It's a

00:51:12.690 --> 00:51:16.150
real quick way to test it out. Platform
specific code, you can

00:51:16.200 --> 00:51:18.750
use plug-ins. It's not a difficult
process. We just saw it.

00:51:18.800 --> 00:51:21.970
You have two libraries. One is a
stub, one is not, and they just

00:51:22.020 --> 00:51:24.750
share a file between them. You
can compile that and just call

00:51:24.800 --> 00:51:27.180
that within your Unity
C# files. Super easy.

00:51:27.920 --> 00:51:30.910
And please, take advantage of the tool
we've put out there, Microsoft

00:51:30.960 --> 00:51:33.840
Visual Studio community edition,
Visual Studio tools for Unity,

00:51:33.890 --> 00:51:37.360
really create a cool experience
running inside of Unity.

00:51:39.140 --> 00:51:42.160
Thank you very much, stay tuned one second
for a slide with some resources.

00:51:44.610 --> 00:51:47.630
Tomorrow morning, I will be...
tonight from 6:00 to 8:00, we'll

00:51:47.680 --> 00:51:50.970
be doing the expert zone. Tomorrow
morning, I'll be working in

00:51:51.020 --> 00:51:54.230
the insiders area. If you have any
questions, Unity game development,

00:51:54.280 --> 00:51:57.150
relationship advice, anything you
want, come visit me over there.

00:51:57.200 --> 00:51:59.460
Thank you very much and enjoy
the rest of your Build.

