>> You know Visual Studio Toolbox,
it's all fun and games.
We always have fun. Today, we're going to
see with Visual Studio in Unity.
That you can build games like this.
Hi, welcome to Visual Studio Toolbox. I'm your host
Robert Greene, and joining me today is
Arturo Núñez. Hey Arturo.
>> Hey Robert, how are you?
>> Good. Arturo works with Unity,
and so we're going to talk today
a little bit about gaming.
>> Yes.
>> Unity and Visual Studio have
gotten along very well together for quite some time.
It only gets better.
>> Yeah.
>> So, you're going to show us some of
the new things in the latest version in Unity,
latest version Visual Studio,
you're going to turn me into a game writer in
less than 20 minutes. This is going to be awesome.
>> Possible, yeah.
>> Cool.
>> Yeah.
>> So, let me talk to you about Unity first.
>> Okay.
>> So, of the audience who doesn't know what Unity is.
Unity, it started as a game engine.
But now, we call it a creation engine.
Basically, you can create games but you can
also create interactive applications for VR,
AR in 3D, 2D.
>> Right. >> So, that's what we are doing.
>> So, if you do HoloLens, there's Unity.
If you do mixed reality there's Unity.
>> Right. So, we support 30 plus platforms.
So, basically, if you want to
deploy your project to any platform that's out there,
you can with Unity.
>> Yeah. >> Cool.
>> Yeah. So, the tool is pretty easy to use.
So, if you're an artist, you can grab Unity,
you can create something cool without having to program.
If you're a programmer, you have
complete control over what you want to do.
Like, if you want to program the graphics,
you can do that.
If you want to program the behavior of
your characters or the things that's there,
you can absolutely do that using C#.
>> Right. >> As a language we support.
>> So, you create the graphics,
the UI if you will in Unity.
>> Yeah.
>> Which has its own IDE, and then in Visual Studio,
you do the scripting.
>> Right.
>> You can do in C# and other languages
to actually control what happens.
>> Right. So, Unity takes care of
everything like the rendering,
the audio, all of those things for you.
So, you just need to focus
on the behavior specific for your project.
>> Okay. >> That's how it works.
It's C#, we support other languages
but the best experience is, it's using C#.
>> Right.
>> Yeah, that's what Unity is.
Yeah. So, let me show you.
>> All right.
>> A demo using Unity.
So, this example is called AngryBots,
something like six years ago,
at the same demo, now with
the new newest features of Unity,
we're showing the same project
but with a newest graphics addition.
>> Okay,.
>> This is how Unity works.
It's an editor, it's software,
so you can basically drag
and drop stuff into your project.
So, in this case, I created
these spider robot in another program.
These are 3D models, the textures
were made in another program.
I bring those into Unity,
and I simply can position them whenever, whatever I want.
>> So, you need to have this type of graphics capability?
I need to be able to draw floors and robots?
>> That's a good question.
Usually, you can you if
you have the ability to make them.
However, we have something called the Asset Store.
>> Okay.
>> So basically, if you just want to focus on
the coding part, you can go there,
grab some stuff that it's premade,
some animations are premade,
and just use them for your project.
>> Right, and then you can edit those if you want to?
>> Yeah, absolutely.
>> Okay.
>> If you like this spider but you want another color.
>> Right.
>> Or are you trying to make some more changes,.
>> More legs or fewer legs.
>> Right, that's possible.
>> Okay.
>> So, that's how you create your-
>> Okay.
>> - world. You can have
a 2D or 3D project
and the only thing you have to do is simply,
click "Play" to start the simulation of
your project and you can start playing right away.
>> Okay.
>> So, Unity also takes care of all the input.
So, if you're playing on a PC or an Xbox One,
or whatever Unity will translate that input
into whatever you were working on.
So, it's a really simple game,
a shooter, that space marine.
We have a lot of tools inside
Unity to create these things.
However, the powerful thing
here is that you, as a programmer,
can add behavior on
top of everything that Unity offers you,
either on the runtime or on the editor.
Unity is fully extensible.
So, if there is something
that Unity doesn't have right now,
you could go there and extend the Unity Editor.
So, yeah that's in a nutshell what Unity is.
>> So, the creatures that
bought the space marine
that comes with some built-in behaviors,
like the ability to go forwards and backwards,
and left and right and jump, et cetera?
>> Yeah.
>> Then, you program additional stuff?
>> Right. So, some
of these objects already come with built-in behavior.
>> Okay. >> So, if you want to start
prototyping or doing some of those things,
we offer you a collection of
assets that you can simply drag and drop,
and start having something
like a camera that moves around.
>> Okay.
>> Or a character that walks around.
But as you progress during your development,
maybe you want to code the specifics
for that project you want.
>> Okay.
>> That's where.
>> Because I think that if you're just starting out,
you'd want to reuse stuff that's already made.
>> Yeah.
>> You get the feel for how it works.
>> Yes.
>> Then, get better and better in terms of creating
your own assets, et cetera.
>> Right. So, yeah.
That's the idea that used to get,
started using Unity real quick.
But if you are an advanced user,
you can do whatever you want.
>> Okay.
>> Yeah, that's it.
So, this is the editor of Unity
and the best idea ID for editing your C# code,
and I'm saying these truly, it's Visual Studio.
>> Yeah.
>> I've been using Visual Studio for forever.
Every time, we are working closely with Microsoft,
so the experience gets better and better.
>> All right.
>> So, now, we have the ability to
debug your Unity projects
in Visual Studio and the workflow,
it's so clean, it's so fast.
That's one of the things that I'm super excited.
>> Cool.
>> So, yeah. This is a basic C# script for Unity.
Basically, if you want to respond
to Unity's built-in messages,
you need to extend MonoBehavior class.
>> Okay.
>> But you already know C#,
I will say, you are like on the other side.
>> Right. >> You already know most of
the things you need to do to start.
>> So, it brings up an interesting question.
Unity is on the Mono runtime.
>> Yes. >> Right? So, what version of C#,
what version or equivalent
version of .NET if I come in here?
>> Yeah. >> How much of what I'm used to,
would I be able to actually run inside here?
>> Right. So, we're revamping that.
A couple of years ago, we were still
using old versions of C# and Mono.
Right now, we offer support for the equivalent of 4.2.
>> Okay.
>> 4.X runtime.
C#, currently we support C# 6.
>> Okay.
>> But with the newest version of Unity,
we're going to support C# 7 feature.
>> Okay,. >> So, we're trying to get there
to provide the latest tools that are out there.
>> Right. >> Yeah.
>> Then, that gives you the ability not
only to do basic C#,
but call into various frameworks stuff,
talk to Azure if you want to
store information up on the cloud or whatever.
>> Yeah. >> Because it's.NET.
>> Yeah.
>> Right.
>> Absolutely.
>> Cool.
>> So, yeah. That's something that you can absolutely do.
Also on the performance side,
now with these upgrades of the runtimes,
recurring performance boosts,
also some bugs have been fixed now.
>> Yeah. >> So, it's pretty.
>> Okay.
>> Yeah. So, yeah,
I just want to show you.
>> Yeah.
>> A couple of things of how the workflow works.
If you are using Visual Studio and
Unity, so for instance,
as you have seen here,
Unity comes with a project window.
>> Right.
>> So, this part of window
has all the assets in your project.
So, from textures, sounds, scripts, videos, everything.
If you're a programmer, you might not
necessarily care about these assets.
You just want the code,
you just want to have the scripts somewhere at hand.
So, with Visual Studio,
if you go to "View" window,
there is a new "Unity Project Explorer",
and this tool allows you just
to see the scripts in your project.
>> Okay.
>> So, if I'm just focusing on programming right now,
I don't need to worry about clicking other assets
that I don't care about.
Another cool thing, and this is
if you know already C# but
you don't necessarily know
the specifics of the Unity API.
>> Right.
>> You can go to the documentation, do things like that.
But if you just want to to get up to speed with this,
there's an awesome feature.
>> Then, I see the screwdriver.
There, you see your full support for Roslyn.
>> Yeah. So, yeah.
>> Or at least, much support.
>> Yeah. So, yeah.
>> All right.
>> So, there's an option if you click "Ctrl+Shift+M",
the Implement Unity Messages option appears.
So, all the messages you can see here
are messages that any MonoBehavior
can be seen from the engine.
So, every time you click "Play",
Unity calls start on
all the objects that are on the scene.
So yeah, sometimes, we have a lot of them.
>>Yeah.
>> So, maybe you don't know all of them,
this feature, it's pretty useful.
So, in case I want to say,
"I'm pleased Visual Studio."
Define sorry- The "On Trigger" enter message, right?
If I want to listen to
whenever two objects collide with each other,
then Unity is going to notify me.
Okay, something collided here.
I didn't have to go to a browser to search
how it's their correct signature for this method,
so it's pretty quick.
I also want to show you how easy it is to debug.
This is very important because in
the previous IDE Unity used or what's it shipping with;
it was hard to do the bombing.
So, developers ended up just
printing everything to the console.
It's difficult to do that.
That's not the best tool to that.
Within Visual Studio, you can
simply add your breakpoints,
as you do if you already know how to use Visual Studio.
In this case, this breakpoint will be called
every time I shoot a projectile.
>> Okay.
>> Within Unity, I can simply "Attach to Unity and Play".
So, I don't need to be switching
between Unity and Visual Studio so I can simply say,
Visual Studio, launch Unity,
while you connect to that process.
So, I can now start
debugging my project here.
So, as soon as I shoot,
Visual Studio captures that event,
and I can inspect as you already do in Visual Studio.
>> Very cool.
>> Yeah, it's pretty cool tools for developers.
Also important because Unity
is now used by the other industries.
People making interactive applications, so yeah,
most people are new to
programming so having these tools at hand,
Visual studio is very important for us.
>> So, new to programming.
What if you've been doing .NET for a while, C#,
web apps, line of business apps,
and now you want to try it here at gaming?
>> Yes. >> So, the part where you write
C# code in Visual Studio is pretty familiar.
You can go to
the asset store and get a bunch of assets, but
how hard is it for somebody
that's just used to writing regular line of
business apps to come over and
learn the world of gaming and-
>> Right, and the graphics and things like that.
>> -and graphics?
>> Yeah. So, there are a lot of
resources on the web on how to learn
using Unity either by
the community but we also have official documentation.
I think it's fun to work on these,
because if you are trying to follow a tutorial,
you're making a game, right?
>> Right.
>> So, you get excited about shooting a star,
about collecting points and things like that.
So, there's a lot of documentation on that.
One thing I always recommend people on doing is at
least knowing the basics of graphics or math.
It's not required, but I
think you can have more fun if you do.
>> Right. Yeah. Well, you have
to understand the underlying platform.
Like if you say alarms,
use Xamarin and write mobile apps,
because Xamarin is just C#.
>> Right.
>> You get over there and the code you write is similar,
but if you don't really understand
the iOS runtime or the Android runtime,
how great an app can you write?
If you come over into Unity and you
know C# and you know a few things we don't
really understand what that engine is doing,
how great a game can you write?
So, you do ultimately
need to get pretty good at that kind of stuff.
>> Yeah, absolutely. Another thing that is-
>> But you don't want to have to wait to
master that before you can
create your first game where somebody runs
backwards and forwards and jumps, right?
>> Yeah. So, yeah,
definitely you do need to know
the underlying platform you're running,
the hardware you're running because
you're writing a mobile game.
But it's too process intensive,
it's going to drain the battery
in a couple of minutes, right?
So, you don't want that experience for your user.
One thing that Unity already takes care of is
trying to write the optimized code
for each platform towards port two.
However, you still need to know,
as you said, the underlying platform you're targeting.
>> So, how does that part work?
You want this game to run on PCs, on Macs,
on various phones, obviously the code behind is the same-
>> Yes.
>> -any has the ability to compile into those platforms,
but you have to do the UI differently?
>> That's an interesting question. You don't.
We provide you tools,
you define your UI,
for instance, in a certain way,
and then Unity will take care of scaling,
and managing all those things.
As you said the code that you write is the same,
Unity will take care of compiling
to the specific platform.
The only thing you need to do basically
most of the time is just tell Unity;
Okay, I want you to build two Xbox One, for instance.
>> Okay.
>> In this case, I don't have the component loaded.
I need to go to the Internet and install it, okay?
>> Okay.
>> But it's super simple to do that.
>> Okay. Cool. Then you
may decide that your game is too
busy for smaller form factor-
Yeah.
>> -and then you might have to adjust it that
way if the scaling doesn't take care of it for you.
>> Yeah. Another thing is given
the hardware differences between
devices like if I'm burning here,
I might not care about
my computer draining the battery because I can plug in,
but if I'm on the cell phone, I am. So-
>> Sure.
>> -yeah, you need to take care of those things.
There are a lot of other components that
you can understand if you want,
if you're interested into that,
but some of the other things you don't have to.
You just want to have a lighting source,
you put a light there, it will work,
and you don't have to worry about that. So, yeah.
>> Cool.
>> So, you can grab Unity for free, if you're starting.
There is a personal edition if you want to try it out.
Everything is unlocked, meaning that you can do whatever,
that engine is not locked with any features for
pro customers or anything
so that you can just play around with that.
Also, I know the audience it's interested
in like open source platforms,
or open source projects.
Unity itself is not open source.
However, we are opening many of Unity's components.
So, the UI is open source,
the networking is open source,
many of Uniti's components are open source.
>> Cool.
>> You can collaborate, you can
receive what's underlying the platform.
>> Right.
>> That's possible.
>> If you wanted to you could use
Visual Studio Code to do
the scripting as well, obviously?
>> Yeah, you could.
>> You just don't get the nice tie in from IDE to IDE.
>> Right. So, yeah. Those are our C# scripts, so-
>> Right.
>> -you can edit them anywhere.
>> Okay, cool.
>> But If you want to have all the speed of development.
>> Right.
>> That's it. Unity is available on Mac for-
>> Okay.
>> -for authoring. So, if you
have Visual Studio on the Mac,
the experience is going to be the same.
>> Okay. So, Visual Studio for Mac
also ties in just as nice.
>> Yeah, it works great.
So, it's important because
before if you were developing on PC and then
you had to switch to
Mac to do iOS development or something,
you had to switch your environment,
but now you can have
the same stuff running on both platforms.
>> Awesome.
>> Yeah. So, also we're
announcing this partnership with Unity and Visual Studio.
There's going to be a bundle out there,
so you can save a couple of
$100 if you get Unity and Visual Studio.
>> Okay. So, if you already have
Visual Studio you can just get
Unity user for free
and then at some point you have to pay,
probably if you're now selling games and whatnot,
I would imagine, right?
>> Yeah. Well, so, our licensing
it's pretty good I think.
You don't have to pay us anything if you make
less than $100,000 per year.
>> Oh, okay.
>> You can even make money out of your projects,
you don't have to pay after
you passed that amount, you have to-
>> We get to the point where I'm
making six figures on a game,
I'm probably pretty happy to pay.
>> Yeah. >> I think it's fair.
>> Yeah, correct.
>> No danger of that happening any time soon.
>> Yeah, we don't charge royalties.
>> Okay. >> So, if you become
a super millionaire out of Unity of your game,
you just pay your license-
>> Okay.
>> -and you don't have to pay us every now and then.
>> Okay. >> I think it's important.
>> And then the bundle is the ability to buy
Visual Studio and Unity?
>> Yes.
>> Okay.
>> That's the bundle. That's what you save.
>> Cool. All right.
So we'll have links to that in the show notes.
We'll put some links to
some tutorials and some getting started.
Earlier today, you did some getting started videos
is really good stuff on the Unity website,
for how you might get started doing this.
Like anything, start small.
>> Right.
>> Do something simple and then learn bit by bit.
But there's a lot of fun and-
>> It is. It is a lot of fun.
>> It can be a nice change of pace from writing,
the same old desktop and web apps.
>> Yeah, definitely. It's a fun world.
>> Cool.
>> Yeah.
>> Thanks for coming and showing that to us.
>> Thank you very much.
>> All right. Hope enjoyed that,
and we will see you next time on Visual Studio Toolbox.