>> Hi, I'm Jb. I'm an Engineering Manager
int Visual Studio at Microsoft.
Today I have with me Dan.
Dan was an Evangelist at Unity.
Dan thank you very much for being with
us for this Visual Studio 2009 lunch.
>> Yeah thanks for having me.
>> So game development with Unity workload is one
of the most popular workload for Visual Studio.
Yet not every developer is familiar with what Unity is.
So Dan, what is Unity?
>> So Unity is a platform
for creating real-time interactive content.
We were originally founded in game development,
but now we've been broadening outside of
games as other industries start to see this need.
>> What kind of industries?
>> So we're exploring things with
automotive architecture engineering and
construction as well as the film industry as people are
using us to build up and improve their workflows.
>> Very cool. So how
do you build a game with Unity and Visual Studio?
>> Yeah. So why don't we go ahead and hop into
the Unity Editor here and we can show you how it works.
Yeah. So here we have the Unity Editor itself,
so we're actually here in the Scene view
and this is the FPS Sample project.
So this is an internally developed project at Unity.
So you as a developer can go and start to build on top of this,
utilize it, and really
create these really awesome looking experiences.
So let's first go ahead and hop into
the experience and see what this application actually is.
>> Sounds good.
>> All right.
So this is the FPS Samples,
so this is a first-person shooter.
You can walk around the environment,
start to explore, and of course
you can shoot some bullets, jump around.
>> It looks awesome.
>> Yeah. So one error that you might
notice is that once we run out of bullets,
we don't actually reload.
So we'll describe how you can use Visual Studios
to go in debug and solve this problem.
>> Sounds good. All right.
So let's have a look at what it means to
write a debug code for Unity and Visual Studio.
>> Exactly.
So as I mentioned before,
what you do in Unity is you create C-sharp scripts.
>> Okay.
>> So what you can see is in order to write code inside Unity,
you can simply go into
the Create menu and create a C-sharp script.
So let's just call this one TestScriptDan.
>> So what's a script for
Unity or is a different from a simple C-sharp class?
>> Yeah. So what we're doing here
is we're actually providing you with
some boilerplate code that allows you
to interact it interface with the Unity Editor.
>> All right.
>> So once I've created my script here,
I can simply double-click it and that'll launch
Visual Studio which allows me to
go in and start writing code on top of this.
>> Cool.
>> All right.
So you can see here that we're driving for
mono behavior which is a built-in Unity class,
and from here we can create public fields like DanIsCool.
Of course, we'll set that to true.
>> Of course.
>> All right.
So now once we've gone back into Unity,
it's simply recompiles that script right away,
and now we can go and drag
it onto one of our objects in the scene.
>> Because it's basically is a way for
Unity to attach your behavior or?
>> Exactly. What this allows you to do
here is attach components to objects.
From here, you can see exposed properties like this DanIsCool,
a Boolean, which of course we can
uncheck it doesn't really make sense.
>> Okay. So that's your way to editing logic to a script,
but also to surface properties
of subscripts to the IDE or to the editor?
>> Exactly, and this allows people like level designers or
other people creating these experiences to go in
and tweak values that the developer setup themselves.
>> Without having to change the code.
>> Exactly.
>> Cool.
>> Now, let's go ahead and try to
solve that problem that we saw earlier.
>> Okay.
>> What I'm going to do here is I'm going to search
through the entire solution for reload.
You can see how quickly we've now
surfaced all instances of the word reload.
I happen to know that we're using the chain gun,
so I'm going to go ahead and open this script here.
>> Okay.
>> So the way that this works is that we
have different states that were falling into.
In the idle state, this is where the reload is checked.
In the fire state,
we can see an if statement here,
but we don't really know if this is exactly where it's.
>> Can we validate it that this is actually
is in line where there's an issue in your code?
>> Yeah. So we can easily do that.
I go ahead and setting up a breakpoint,
and then clicking the attached to unity button.
>> All right. So that's simply going to attach
to debugger obvious gesture to Unity?
>> Exactly, and now we can restart the simulation here.
If it's in the correct spot,
we should see our application break right after we fire the gun.
>> All right.
>> All right. Now.
>> This is the game.
So now if you should [inaudible] point it,
you're inside Visual Studio,
you have your code stack, you have your values, your valuables.
>> Exactly, and you can see here that the ammo in the clip is 39,
it started out at 40.
So this is the exact point that we want.
>> All right.
>> So let's go ahead and stop that debugging and fix this issue.
>> Okay.
>> I'll remove the breakpoint, and from here,
we can start doing the else statement to enter the identities.
One thing to note here is right after I type the parentheses,
now we see all of the properties here exposed for us.
>> And you get code completion for it.
>> Now we can simply save this here. You'll notice that.
>> [inaudible] ref predicted state.
>> Exactly, and you see that Visual Studios
recognized that and highlighted with a red underline.
>> Cool. Just switch back to Unity.
>> Now let's go ahead and hop back in
the simulation and we should be
able to shoot all the bullets and automatically reload
>>Cool.
>> There we go. Comes off.
>> Very cool. So basically,
the workflow between Unity and Visual Studio
it's a very iterative process.
You fix up the code, you implements script,
you attempt them to your GameObjects,
and you play to game inside
Unity right until you're satisfied with your game?
>> Exactly. It's this really back-and-forth
workflow of writing the scripts in Visual Studio,
coming back to Unity,
attaching the logic, and creating awesome experiences like this.
>> Very cool. So this
is how you use Visual Studio and Unity together,
but what is new for Visual Studio
2019 when it comes to building Unity game?
Well, in Visual Studio one of the things we've been focusing
on is improving the quality of life of Unity developers.
One of the main things that we've been working
on is ID responsiveness.
We wanted to make sure that Visual Studio starts
first so that it loads your project fast and
that you can easily switch back and forth between Unity
and Visual Studio without losing too much time.
>> Yeah, that was one of the things I first
noticed when starting to develop with Visual Studio 2019,
just how quickly the projects load up as well
as things like searching through the entire projects.
>> Cool. Another things that we've been focusing
on is improving the debugger experience.
We know that writing C-sharp in
debugging it is a big part in writing
a Unity game and we want to make sure that
debugging your C-sharp code is reliable and fast.
Another things that we've been doing for the debugger
is adding support for
debugging unsafe code and pointers
which I think is going to play a role in the future of Unity.
>> Definitely.
>> Then, today we've been showing Visual Studio on Windows,
but yourself a Mac Frame.
>> Yeah. Unity was actually originally developed
as an application only for Mac platforms.
Obviously, we've expanded upon that for both Mac and PC
and we really tried to keep
those development experiences the exact same.
>> That's also something that we're doing in Visual Studio team.
For Visual Studio 2019,
a big part of the works that we've been doing is taking pieces and
components of Visual Studio on
Windows and taking them into Visual Studio for Mac.
A big part of the experience for 2019 is in
Visual Studio Code Editor that we've taken
from Visual Studio on Windows to Visual Studio for Mac.
That I think will fix
a bunch of complaint as we heard from customers
about the editing in
the recent experience on Visual Studio for Mac.
Another big components we're taking from
Visual Studio Windows is
the Visual Studio tools for Unity debugger.
This way you get the same debugging
experience on Visual Studio for Mac,
on Windows when you debug a Unity game or to Unity Editor
>> Totally, and there's
a lot of big improvements coming to unity as well.
In 2019, we're redeveloping how you code and build applications
in Unity away from
an object oriented approach into
what we call a data-oriented approach.
>> Okay.
>> So this introduces
the data-oriented tech stack
which is comprised of three main parts.
The first one being the entity component system,
which is how you structure
your data when developing these applications,
the next being the C-sharp job system which
allows you to easily multi-thread and parallelize your code.
>> Okay.
>> And the final one being the burst compiler.
Together, these allow you to create
some really big and incredible experiences.
>> Burst still works
and everything still works with Visual Studio as it does today.
>> Of course, what we're doing
is you're still developing in C-sharp,
it's just a different way of actually writing your code,
to achieve even more performance
on the platform that you're running on.
>> You have a sample for it or something and that's we can show?
>> Yes. So we recently released a mega city,
which is an open source application.
You can see here that it allows you to create
these really big massive scale experiences
that are only available utilizing
this new data-oriented tech stack and the power of Unity.
>> For something said big you didn't assume big machine.
>> So that's actually one of
the best parts about the dots framework is that it can run
all the different platforms that Unity supports and you can
achieve massive scale simulation like this even on mobile devices.
>>Even on mobile. That's very cool.
Well, then it looks like that 2019 is going to be
a big year for Unity developers using Unity and Visual Studio.
We've compiled a list of resources on
screen that you can use if you want to
learn about Visual Studio and
Unity development and thank you very much.
>> Thanks.
[MUSIC]