Build a Unity Game with GitHub Copilot + MCP | .NET Game Development

Build a Unity Game with GitHub Copilot + MCP | .NET Game Development

Microsoft Developer

0:00 Stacey?

0:01 Andy.

0:02 I alt tab so much between VS Code and Unity that my keyboard filed a complaint.

0:07 Oh my god, no.

0:09 Yeah.

0:09 But what if you didn't have to do that?

0:12 Didn't have to do what?

0:12 What if you didn't have to leave to do things in Unity?

0:15 What?

0:17 [laughter]

0:16 Yeah, that's what I'm going to show you

0:17 on today's episode of Now, in all seriousness,

0:24 a lot of people tend to use GitHub Copilot for just code completions,

0:28 but you don't need to do that when you have the Unity MCP server installed.

0:32 Really?

0:33 Yeah.

0:33 Oh, okay.

0:34 Well, what can it do if you have it installed then?

0:36 So, this allows your GitHub Copilot to interact directly with Unity.

0:40 And there's actually a lot that it can do.

0:41 We'll look kind of briefly through the different permissions in it.

0:44 But some of the stuff that it can do is scene management.

0:46 So, it can add or delete or, you know, even create primitives.

0:50 So, I asked it to build a house once.

0:52 That was actually pretty hilarious.

0:53 Uh I was curious.

0:54 It did it.

0:55 Yeah.

0:55 It did it, but it was curious its approach.

0:58 Um but then it can also connect into the the profiler information,

1:02 which is super handy for your game.

1:04 cuz then you got Now you got data analysis from your profiler stuff.

1:08 Yeah.

1:08 Um and I mean, there's so much more.

1:10 It's like one of the things that we're going

1:11 to take a look at today is it'll create

1:13 a material and then assign a color to that material

1:16 and then assign that to a primitive that it creates.

1:19 Okay.

1:19 So, Interesting.

1:20 Yeah, and that's just some.

1:21 Just some of it.

1:22 I've heard a little bit about this.

1:23 And so, is this fully ready to go, released to production?

1:27 Well, yes and no.

1:28 It's an open beta.

1:29 Okay.

1:29 So, you can use it.

1:30 You can use it, but it's going to change.

1:32 Exactly.

1:32 Yeah.

1:33 And so, the steps actually that we're going

1:35 to walk through of like setup and stuff,

1:36 that's going to change um too down the line,

1:39 I'm sure, at least and I'm guessing.

1:41 Uh but no, it is open beta.

1:42 Uh but I myself have been using it for my games.

1:45 I've even extended it.

1:46 It's got the ability so you can add uh custom tools to extend its

1:49 capabilities out and it'll load it in and go through its bridge and its relay,

1:53 uh which is pretty cool.

1:54 Cool.

1:54 Yeah.

1:56 Nice.

1:55 Yes.

1:55 I'm excited to see that.

1:57 Yeah, so let's let's jump jump into Unity and um I'll

2:00 show real quick how to get everything set up and running.

2:03 Okay.

2:03 Okay.

2:04 Um I'm in the package manager.

2:07 And the MCP is installed through the AI assistant,

2:09 which actually has some other capabilities in it.

2:11 They have the gateway, they have the built-in assistant for the Unity engine,

2:15 and then there's the actual Unity MCP that you

2:18 can then use to connect to GitHub Copilot.

2:19 It's all part of this package.

2:21 So I've already got this in

2:22 just want to install one thing And you get all of that.

2:24 ready to go.

2:25 Yeah.

2:25 Ready ready to go.

2:26 And you know what?

2:26 You know, I think you showed me earlier too

2:28 when we were kind of like looking at this.

2:30 You were saying, "Hey, this is what we're going to talk about today, Andy.

2:32 You better get

2:33 [laughter] You better know what we're talking about.

2:34 talking about.

2:35 You showed me the documentation and so GitHub has

2:37 all that documentation so you can install, configure, use.

2:41 It's all up there, right?

2:43 GitHub.

2:43 Oh, not GitHub.

2:44 Not GitHub.

2:44 No.

2:45 Uh but yes, no, they have the package Yes, Unity has it.

2:50 [laughter] Got you.

2:50 But yes, there is documentation that'll walk

2:52 you through all of the getting started stuff

2:53 and even I I think the customization I want to say is in the documentation, too.

2:58 Which for me this gets so much more powerful when you start to extend it.

3:02 I bet.

3:02 Um but yeah, it'll it'll show you it's a you can go to the plus sign and then

3:06 do um uh install package by technical name

3:09 and then there's like I think it's like com.unity.assistant.ai,

3:13 I want to say, but check the documentation.

3:17 Not for GitHub, for Unity.

3:21 yes.

3:21 Um you can I He's He's saying GitHub cuz I was

3:23 mentioning that my extended custom stuff That's where you got that.

3:27 yeah, yeah.

3:27 I have mine hosted on GitHub.

3:30 Yeah.

3:30 Um Yeah, cuz you can install from a Git repository, which is cool.

3:34 You just give a URL and

3:37 Exactly.

3:37 right.

3:37 That's cool.

3:38 I like that.

3:38 I love that Unity has this in their package manager.

3:41 You can kind of do these little ad hoc

3:43 packages and add them in there and really customize things.

3:46 Yeah.

3:46 Yeah, and really streamline the install, which is great.

3:49 Okay, so once it's installed, you can go to edit,

3:52 project settings, and let's actually make this full screen.

3:55 And then there's a new section called AI that will show up.

3:59 And then what we're going to be looking at today is the Unity MCP server.

4:02 Okay.

4:03 So, uh Conveniently have it already selected.

4:05 I do conveniently.

4:06 I know, it's the magic [laughter] of pre-preparing your demos.

4:10 Nice.

4:10 Uh which will fall apart because that's the rule of demos,

4:13 so get [laughter] ready.

4:14 Good.

4:16 [gasps]

4:16 So, um there's several settings here.

4:17 The big thing, there's actually three major areas that I want to talk about.

4:21 The first is the Unity bridge.

4:23 Okay.

4:23 So, this This is a really important.

4:26 It's the connection between your GitHub Copilot,

4:29 well, part of the connection, and Unity.

4:31 So, the way that the MCP actually works is you install uh a bridge,

4:36 which we can see that's running cuz it's green right now,

4:38 and then there's also a relay that gets installed, a binary relay.

4:42 Okay.

4:42 Now, what will happen is when you register your MCP tool within GitHub Copilot,

4:47 it will um it'll actually pass its requests over to the relay that then

4:51 talks to the bridge and and has that to interact within the Unity editor itself.

4:56 Okay.

4:56 So, you want to make sure that the bridge is running,

4:59 which we can see with that green running.

5:01 But, if at any point, cuz again, this is a beta, things break in beta.

5:04 If at any point the AI loses connection with it,

5:07 one of the first things I always try

5:09 check that setting and make sure it's running.

5:11 And if it says, "I can't talk." or whatever, then you just stop and start.

5:15 Yep.

5:15 And sometimes, honestly, that doesn't always fix it.

5:17 Have you tried turning it off and on?

5:18 That is actually how you fix it.

5:20 So, you can shut off Copilot, shut off Unity,

5:22 bring them both back, and that'll it'll purge it.

5:25 Cool.

5:25 Okay.

5:26 So, I mean, again, it's beta.

5:27 I'm sure that'll get fixed down the line,

5:28 but if you run into it, those are the techniques I use.

5:31 So, um jumping back into these project settings,

5:34 the other thing, there's connected clients,

5:36 which we'll talk about in a minute, so we'll just put a pin in that, as it were.

5:39 Um there's tools, so you can see I have 51 of 52 enabled.

5:43 Mhm.

5:43 Um this is cuz that this is a new one.

5:46 So, these are all the tools that the MCP is exposing.

5:49 Yes.

5:49 Yeah.

5:50 are the things that the AI is allowed to do.

5:53 Should we talk about what MCPs are yet?

5:54 Yes, we skipped right over that, didn't we?

5:56 really.

5:56 I mean, I thought we could talk about it

5:58 either later or when we're showing configuration or something.

6:00 I think it's kind of perfect.

6:01 This is a great time.

6:02 Yeah.

6:02 So, MCP, model context protocol,

6:05 is a communication protocol that exposes features and capabilities to LLMs.

6:13 So, Copilot can be extended by registering an MCP server,

6:18 which then exposes these tools, as as you can see listed here, to Copilot.

6:24 So, when Copilot sits there and says, "Hey,

6:26 Stacy wants me to create a scene." So,

6:30 the the LLM, the Copilot, it doesn't know how to do a Unity scene.

6:34 It doesn't have that knowledge built into it.

6:36 But, it goes and scans its tools that are available to it and it sees,

6:38 "Oh, there's a Unity create scene tool.

6:41 So, I'm going to send all the data, the information that Stacy gave me,

6:44 Yep.

6:45 to that tool.

6:46 And then now it's it's handed it off,

6:48 and the tool is going to take over and do it.

6:51 And then it's going to give back results to Copilot.

6:55 Yes, exactly.

6:56 And actually, the way that the MCP works

6:58 is it takes um either one or no parameters,

7:00 I should say the tools work, is it takes either one or no parameters.

7:04 And the parameter that it can take is a record.

7:06 So, C sharp records.

7:08 Yeah.

7:08 Um and then within that, you can have multiple.

7:11 And so, when the AI is going to communicate with the tool to make that request,

7:14 it actually has a list of stuff that it can send up as parameters with it.

7:18 Yeah.

7:18 Yeah.

7:19 Um and then the tools can also define

7:22 um a success or failure result with messages.

7:25 And then it can even send complex like JSON-structured stuff back to it.

7:30 Results.

7:30 And then the LLM kind of takes over and figures out how to how

7:33 do I present that to the user and tell them what's going on?

7:35 Exactly.

7:36 Cool.

7:36 Okay.

7:36 it's pretty cool.

7:36 So, the way that I love to think about the MCP servers or tools in general,

7:40 cuz there's a whole host, right?

7:41 GitHub is my other favorite one that I use all the time.

7:44 Yeah.

7:45 Um and it I think about them as like adding deterministic behavior.

7:48 So, you said earlier that GitHub might not or No, I'm doing it.

7:55 [laughter] That Copilot might not know how to uh make a scene, right?

7:57 But it could go and check out documentations and call a you know,

8:01 write a random script and run that to go do it.

8:03 But this kind of streamlines that.

8:06 Yeah.

8:07 So, it doesn't have to investigate how to solve a problem.

8:09 just call the tool.

8:09 It looks at the tools and says, "Do any of you" It looks at their descriptions.

8:13 "Are any of you solving this problem?

8:14 If so, I'm going to hand this off to you." Yeah.

8:16 And Got You go figure it out.

8:17 Perfect.

8:18 Which actually takes me to one of the permissions.

8:20 So, if we look through this permissions list,

8:22 I'm not entirely sure where it's at.

8:25 Uh here it is.

8:26 Run command.

8:27 Okay.

8:28 So, this one Oh, look at details.

8:30 You kind of get the description of what the tool is.

8:34 This is kind of what the what Copilot will read about the tool.

8:37 Yes.

8:38 Understand if it's your call it.

8:39 Yeah.

8:39 So, what I have found with Copilot is if it's trying

8:42 to do something and there's not a tool that's readily available,

8:45 it'll actually write something and run it through the run command.

8:47 So, it's kind of like a catchall.

8:49 Yeah, cool.

8:49 Yeah.

8:49 Nice.

8:51 Okay.

8:51 So, next we're going to would do some VS Code setup.

8:54 Yes.

8:54 So, depending on if you're going to go with uh VS Code,

8:58 the GitHub Copilot CLI, or even Visual Studio

9:02 or Um there's a slightly [clears throat] different

9:04 setup for where you would put the MCP.json file.

9:07 So, what I'm actually going to show right now is setting it up with VS Code.

9:13 Um and I actually do want to call out there is uh an integrations tab.

9:19 Okay.

9:20 As of recording, the VS Code GitHub Copilot configure did not work.

9:24 Okay.

9:25 So, I just kind of want to flag that this is

9:26 one of those bugs that I'm sure will get fixed.

9:29 right before we started coding or started doing this recording, it updated.

9:33 So, we don't know if it It may could work now,

9:35 but you're just going to sort of show

9:37 not going to do that.

9:38 You can show us what what you know works.

9:40 Exactly.

9:41 So, um the nice thing down here is this example configuration.

9:44 This is actually the configuration if you're going to go create the raw file,

9:47 you can copy this and the only thing you need

9:49 to do is is just change this instead of MCP uh servers,

9:53 it's just servers with a lower case S.

9:55 Everything else you could literally just copy and it would work.

9:58 But VS Code actually has a very streamlined flow for this.

10:03 So, I'm going to copy I'm actually going to copy this path.

10:06 This is the path to my relay, which is what you're registering.

10:09 Got you.

10:11 And then we will switch to VS Code.

10:12 So, uh I don't know if you saw this, but VS Code recently did a really,

10:16 really nice update to Copilot and all of the settings for skills.

10:20 Yeah, I saw Yeah, really nice.

10:23 makes it easier to configure everything.

10:24 Yeah, so you can just click uh this little

10:27 custom open customizations wheel and I'll make this big.

10:31 And so you can see it.

10:31 And so yeah, so now it's just this beautifully streamlined

10:35 over to MCP servers, put it in, you Yes.

10:38 know.

10:38 That's cool.

10:38 I like that.

10:39 Cuz it used to be like you have to open the command palette,

10:41 find the command for adding an MCP server, and then doing it manually.

10:46 Not anymore.

10:47 So, now we can do is come here, hit the plus button.

10:50 And then you can go into commands and we can just

10:53 paste in the path to the command that you're going to run.

10:57 Yeah.

10:57 But I didn't need to bring the these uh And and then what we

11:00 actually want to do is we do want to pass it in an argument.

11:03 Okay.

11:03 Which was it was down below in in the

11:06 In the thing you copied could have copied Well,

11:09 it'll separate it out into separate arguments, so you can copy it in.

11:11 right.

11:11 Cuz you're just doing Yeah, yeah.

11:12 Cuz you're just saying what's the actual

11:14 command line completely that you're sending.

11:17 Okay.

11:18 So, now uh you're just sending the {dash} {dash} MCP argument.

11:22 And then you have to name it, so we'll call this Unity MCP.

11:25 And that's going to bug me that's not capital.

11:27 And then you can set this as global or workspace.

11:30 Yeah, cuz it's still writing this into a config file.

11:32 Yes.

11:32 So, if you have it in your workspace, what does that mean?

11:35 It's just to I don't know how to explain that without the word workspace.

11:41 [laughter] Well, it's it's your your Co-pilot running

11:43 in your workspace has access to this, right?

11:45 Yeah.

11:45 But if it's globally,

11:46 then when Co-pilot runs in any workspace, it'll just be available.

11:51 Okay.

11:51 Yeah, exactly.

11:52 I will I'm just going to set this up in workspace for now,

11:54 but I don't know why actually I messed up this in global.

11:56 I don't know why you would just set that up.

11:58 I hope this is what [laughter] you practiced for your first sleep.

12:00 But Oh, look, it says it just launched it right here.

12:02 and we can see that it's running.

12:04 So, now if we come back, let me close this window,

12:08 and we can actually see our MCP.

12:10 Yep, nice.

12:11 Okay.

12:12 Yeah.

12:12 And so, if Ooh, is it those slashes the double

12:16 slashes in there cuz it escaped your slashes?

12:18 yeah.

12:19 I think you should fix those up real fast.

12:20 just going to bug me.

12:23 Yeah, this is This is something that could happen.

12:29 Okay.

12:29 So, now if we come into Unity, it shouldn't be nothing that's changed yet.

12:33 So, we don't see anything Of course we do.

12:37 We [laughter] can see prior connections of my prior attempts listed here.

12:41 Ah, I see.

12:41 Yes.

12:41 Uh so, we're actually probably not going to get the pop-up.

12:45 Let's do uh let's Oh, this is insiders, but still let's go ahead and revoke.

12:50 So, uh what I want to show I think that'll do it.

12:55 Let's see.

12:56 So, if I come back into Co-pilot and I'll say um check Oops,

13:00 I can't spell the word.

13:01 Check the Unity console.

13:03 It should call the MCP tool.

13:05 Okay.

13:06 But in theory, it shouldn't actually be able to do anything

13:09 because you have to when you're connecting something for the first time,

13:11 it'll actually pop up Like a permissions thing or something?

13:15 request.

13:15 Okay.

13:15 Um and so, I might have goofed that since I already had them.

13:19 So, is it Unity that pops up the permissions request?

13:21 see that inside of Unity.

13:23 Unity is going to say, "Hey, something's trying to communicate with my MCP,

13:27 or do you want to allow it?

13:29 Do you want to allow it?

13:29 Okay.

13:30 And that's kind of what we saw right here.

13:31 I rejected it for VS Code Insiders.

13:33 Yeah, you can't see it anymore.

13:35 Um so let's see.

13:37 Okay, so now what's happened over here in GitHub

13:40 Copilot is it said it kind of disappeared really fast,

13:43 but it said the user wants me to do a check like a check on it.

13:46 And so now it's coming back.

13:47 You can see Unity MCP and it's trying to call the um the console.

13:52 It's trying to call a get on it.

13:53 Got you.

13:54 And so So from the Copilot side then you have to approve You do.

13:58 actions sometimes, but then you can sit there and say, "You know what?

14:00 Approve all these from this MCP.

14:02 I I trust it." Yeah.

14:03 You know, you can figure things like that.

14:05 Uh okay, so it says it's been revoked cuz I

14:07 did that [laughter] So you're going to try it again.

14:10 But here's what's fantastic.

14:12 I've actually never had this UX happen cuz I've I've never revoked.

14:15 Oh, it told you how to fix it.

14:17 told me how to fix it.

14:18 Yeah, that's pretty neat.

14:19 So let's come back over.

14:20 We're going to un-revoke.

14:21 And so normally again what would have

14:23 happened is that dialogue would have popped up.

14:25 Yeah.

14:25 you would have seen it.

14:26 It would have been very obvious what you needed to do.

14:28 Try again.

14:30 Try again.

14:31 You know what?

14:31 You know how you can do the try again?

14:32 No.

14:34 There's a cool tip and trick for VS Code.

14:37 I'll show you in our one of our future videos.

14:38 Oh, what a tease.

14:39 I know.

14:41 [laughter]

14:41 Okay, so we can see the Unity console is clean.

14:42 No logs, warnings, or errors, which is what we expect, right?

14:44 So now you're connected into the MCP into Unity.

14:47 Exactly.

14:49 So all right, that's it.

14:50 Uh I think we're actually Oh, you know what I do want to talk about?

14:52 I want to talk a little bit about kind

14:56 of best practices for getting Copilot to work within Unity.

15:00 Okay.

15:00 Um and so this is there's some customization stuff that I've already

15:03 done for this project even though nothing's built in the project yet.

15:06 Um we have some custom files.

15:11 I'm in the wrong folder.

15:12 So I'm going to go ahead and just close

15:13 Copilot down so we've got a little more space here.

15:15 Got you.

15:15 So there are three files that have been created.

15:17 The Copilot instruction file, Mhm.

15:19 a custom agent, and then three skills.

15:21 Okay.

15:22 So, why would somebody want Copilot instructions?

15:25 All right.

15:25 So, Copilot instructions are instructions that get sent

15:30 with every prompt that you send up through Copilot.

15:34 Yes.

15:34 So, these are like sort of um guidance,

15:39 concrete guidance you don't want to change.

15:42 Like, you want this here all the time.

15:43 Exactly.

15:44 So, want to see something super cool?

15:46 Okay.

15:46 All right.

15:46 So, I just deleted the project info.

15:48 Yeah.

15:49 You You didn't save your file.

15:50 How do you need to do that?

15:50 I do.

15:51 All right.

15:51 You should save your file.

15:52 Yeah.

15:52 Let's save that file.

15:53 I just noticed it wasn't saved.

15:54 I don't know what you're doing.

15:55 I don't know what I'm doing either.

15:58 [laughter]

15:58 So, what I can actually say to you Copilot is

16:01 fill out the project info based off of the MCP tool.

16:08 Which tool?

16:09 I want it to figure that out.

16:10 Oh.

16:12 [laughter] Interesting.

16:13 Who's being a tease now?

16:14 Copilot, I'm not going to tell you what to do.

16:16 Look what it did.

16:17 Returns basic project data to generate the markdown file.

16:20 So, I'm going to say go ahead.

16:21 That's actually how I did this originally.

16:22 Okay.

16:23 Cool.

16:24 So, this is going to Although, now I add stuff in there.

16:28 Yep.

16:28 So, I'm going to say keep and we're going to close this down.

16:30 And so, remember I I mentioned that it can get structured data back.

16:34 This is an example of that.

16:36 Nice.

16:36 Yeah.

16:37 So, this this Co- So, Copilot talked to Unity.

16:40 Yep.

16:41 Said, "Hey, give me information about the project."

16:44 And then this is what Unity wrote back.

16:46 And then you put it in the instruction files.

16:48 Or Copilot put it in the instruction files for you.

16:49 Yeah.

16:49 So, if you were to add this into like an ongoing project for the first time,

16:53 then it's obviously going to have more information to go and pull back in.

16:56 Yeah.

16:56 So, and this is good because like anytime

16:58 you're talking to Copilot to get some actions done,

17:01 it's going to know like, "Oh, what's the name of your project?

17:03 What's your main scene file?

17:05 What render pipeline settings you're using?" It cuz because

17:08 this Copilot instruction file is sent with every prompt,

17:10 it's going to know these settings.

17:12 Yep.

17:13 Exactly.

17:14 another tool you use from Unity's MCP needs these settings, it already has them.

17:19 It can provide them.

17:19 Cool.

17:20 Okay.

17:21 All right.

17:21 So, that's the instructions file.

17:23 Now, let's talk about I like to We can actually close the JSON file, too.

17:26 I like to talk about custom agents.

17:28 Mhm.

17:28 Custom agents are fun.

17:30 These These were uh just a game-changer for me.

17:32 The second that custom agents were introduced,

17:34 I started getting insane results out of game development.

17:39 Yeah.

17:38 Um Why?

17:39 Well, because so custom agents let you define domain expertise.

17:43 Okay.

17:44 Yep.

17:45 So, I have uh in in my own personal projects,

17:48 I have a custom agent that's a C# programmer.

17:51 I think I call it something slightly different, but that's what it does.

17:53 Uh I have a custom agent that understands UI Toolkit.

17:58 Um a build and test agent.

18:00 Like it's just I have just a whole host

18:02 of custom agents and the list keeps growing um on it.

18:06 But then what can happen is I can go and set

18:08 the custom agents when I want to go and do UI Toolkit work,

18:13 and it does uh just a far better job I mean, I say far better job.

18:17 I could not get UI Toolkit written until I had a domain expertise.

18:20 So, you're saying that they're your minions.

18:23 Yeah.

18:24 That's what you're basically doing.

18:25 You're creating your own AI army of minions to do your bidding.

18:28 Yeah.

18:29 I'm not going to say evil, but I'm just going to say bidding.

18:31 Well, I feel like I wanted to.

18:33 Yeah.

18:33 No, I didn't.

18:34 Um No, yeah, you know,

18:36 I've used custom agents uh at work to get like you said, domain expertise.

18:42 So, custom agents that are very skilled in doing a certain types of activity.

18:47 Yes.

18:47 And you know, let's show that agent file again real fast.

18:51 The So, the agent file is very similar to the Copilot instructions file.

18:56 Because these are when you when you select this agent saying,

19:00 "I'm going to send a prompt, and I'm going to use this agent." Yes.

19:03 It's getting these instructions and your Copilot instructions all in one go.

19:07 Yeah, exactly.

19:08 And you can set that by going to if if in uh VS Code,

19:11 uh clicking on agent, and then doing Unity programmer.

19:14 Yeah, so it's going to VS Code is going to scan your agents folder,

19:17 find your agents, and put them in that drop-down for you.

19:19 Exactly.

19:19 Yeah.

19:20 Nice.

19:20 Okay.

19:20 Um and then you can even do things

19:21 like having uh handoff prompts between agents, too.

19:25 "Hey, go talk to agent X." And And then it'll do some work.

19:29 information, get it back to me.

19:30 Okay.

19:31 it's pretty neat.

19:31 That's nice.

19:32 I've not done that before.

19:33 You haven't?

19:34 No.

19:34 Oh, it's pretty cool.

19:35 You actually probably don't realize uh when you do planning

19:38 and then that gets handed over and you see implementation.

19:40 Oh, it's doing that.

19:41 Nice.

19:42 Okay.

19:43 Um so you have done that before.

19:44 Maybe.

19:45 Yeah.

19:45 Okay, so then the next is uh skills.

19:48 Skills.

19:48 So uh

19:48 I have done skills.

19:50 Yes.

19:50 So why what why would you use a skill?

19:52 Like one of the things that was really hard for me

19:53 in the beginning to rationalize about was why would I do a skill

19:57 over the other instead of a custom agent?

19:59 Yeah.

20:00 Yeah.

20:00 Like I had a really I I've kind of figured it out,

20:02 but I'm curious like did you Was that

20:04 Maybe I won't explain to you and I'll tell you to explain it to me.

20:07 No, no, no, go ahead.

20:07 Go ahead.

20:08 Okay, so well so like we we talked about

20:10 earlier about the MC-MCP servers that that the MCP servers

20:15 were they're kind of like skills you were exposing

20:20 to skills were exposing to What's the word I'm looking for?

20:25 The custom agent?

20:26 The LLM.

20:27 THE LLM.

20:28 [laughter] I DON'T know what word you're looking for.

20:30 You don't know the words I'm looking for?

20:31 No.

20:32 No, so yeah.

20:33 So uh MCP servers were exposing tools to the LLM that it could utilize.

20:39 Yes.

20:39 And so skills are very similar in that idea or concept,

20:43 but they are skills or tools that you're

20:46 building that you're providing locally for your Copilot.

20:51 Yes.

20:51 So they can be reused across different agents.

20:53 So for example, if you had a skill that says,

20:56 "Anytime you add two numbers together, this is how you do it."

21:01 Mhm.

21:01 And it would now have that that knowledge.

21:04 So when let's say your LLM wasn't trained on adding,

21:07 I don't know why that would have happened, but let's just say that.

21:10 It would go, I don't know how to do it,

21:12 and it would say, do I have any skills that do addition?

21:15 And then it would go, oh, I do,

21:16 and then it would hand off to that skill, and that skill would go do that.

21:20 And that skill could launch scripts, run executables,

21:23 like however you want to authorize the what the skill to do, it can do it.

21:28 Yeah.

21:28 One of my other favorite things about skills,

21:31 and this is kind of where I started to rationalize to the difference,

21:34 is um skills are loaded as needed.

21:37 Yes.

21:37 And so, instead of having some giant custom agent file,

21:41 which is what I originally had, yeah.

21:43 Yeah.

21:43 Uh I can go and have a custom agent file that just

21:46 has kind of the bare domain expertise necessities, if you will.

21:49 It's a really weird way to put that, but um

21:53 [laughter]

21:53 and then that agent can go, oh, okay, I need to going on like the UI toolkit,

21:57 you know, path, oh, I need to know how to do styling.

21:59 I'm going to go load up the styling skill.

22:01 Okay, now I understand how USS works.

22:03 Mhm.

22:03 Uh as an example, and so it can kind of load in.

22:05 And so, skills though, the thing to keep in mind is I think it's

22:08 a description is loaded into the context every single time.

22:12 look at your skill.

22:13 Yeah.

22:14 So, um the description of the skill, which you can see kind of here.

22:17 needs to be descriptive.

22:18 Yes.

22:19 So, the agent the LLM agent can understand if it needs to use it.

22:23 Yes, but you also want to be careful about not being too descriptive because it

22:26 is taking up some of the context window

22:27 because all skills descriptions automatically get loaded in.

22:31 Um Okay.

22:32 So, you're going to kind of balance it out.

22:34 Um but yeah, you can see here,

22:35 I These are skills that I specifically created for this demo,

22:39 just to kind of AI can be unpredictable, right?

22:41 It's not deterministic,

22:42 so just to help things run a little bit smoothly when we go to do it.

22:45 Um but you'll and you should, hopefully,

22:47 notice that we're going to start to see a hierarchy that gets

22:49 built out like this, and that'll be because it's called called the skills.

22:52 Mhm.

22:53 So, with that, I think we're actually ready for the demo.

22:57 What?

22:58 You know what?

22:59 All this theory is boring.

23:00 Let's do it.

23:01 Let's do it.

23:02 Okay, I actually have some prompts um here.

23:06 That is not the prompts.

23:07 That's not prompts.

23:08 That's not prompts.

23:08 That was my other Demo prompts MD.

23:10 Here we go.

23:10 Right down there.

23:11 Everybody online right now was watching this going, "It's right there.

23:15 [laughter] Click it.

23:15 Why don't you see it?" [gasps] Come on.

23:18 Okay, so I'm pulling up Unity.

23:19 I'm going to have this side-by-side with uh GitHub Copilot CLI.

23:22 What you receive we can do with VS Code's CLI or CLI, VS Code's Copilot,

23:28 uh we can do this in Visual Studio 2026 or we're going to do

23:32 it here just cuz it it's nice to see what they have here.

23:34 you're going to you've already kind of made your prompts

23:36 and you're going to paste those from your file,

23:40 your markdown file into that.

23:41 Okay.

23:42 Um the other thing I want to call out is

23:43 cuz the AI can kind of take its sweet time sometimes.

23:46 Uh we're going to speed up When it starts thinking a lot,

23:49 we're going to kind of pause and let us and let this get sped up.

23:54 Yeah.

23:54 Yeah, okay.

23:54 Yeah.

23:54 That sounds good cuz nobody wants to watch it for like 5 minutes.

23:57 No.

23:58 Uh I I think about it in my brain always like the the uh

24:02 old-school animated stuff where like they speed it up like uh Scooby-Doo,

24:07 you know, where they're like running between the doors.

24:09 No, I've never seen that.

24:10 What?

24:11 Just kidding.

24:13 [laughter] All right, so we have Copilot up.

24:16 I am I'm just going to paste in the first prompt.

24:20 So what this is asking that So we kind of have a blank scene, right?

24:24 That's it.

24:24 Blank scene.

24:25 And I'll click on over into Unity so that we can see the changes happen.

24:28 We're just asking for it to make a ground plane, uh set a you know,

24:32 I'm being very specific of like the scale size that I want.

24:35 I'm asking it to uh make a material, set it to green,

24:40 and then apply it to that, and then also asking it to make uh the player.

24:44 So it's going to use primitives to make these objects.

24:47 Okay.

24:49 Okay, so it just appeared.

24:50 Yep.

24:51 Straight up out of nowhere.

24:52 But there's bug.

24:53 You have a bug?

24:54 I have a bug.

24:54 That's not good.

24:55 It's funny cuz it actually did this the last time I ran through this demo, too.

24:59 AI is unpredictable.

25:04 [laughter] What did you say in one of the talks that we gave?

25:05 The only thing predictable about AI is that it's unpredictable.

25:10 So, I realized in this that I forgot to put this I'm

25:12 going to actually let this run in what's known as autopilot mode.

25:14 Okay.

25:15 So, it's just going to kind of we were we're

25:16 not going to see the permission pop up anymore through it.

25:19 Well, they didn't see that cuz it probably got edited out.

25:21 That's true.

25:21 Might have Might have through the spin fast forwarding while we were waiting.

25:25 Um yeah, so it just popped up the prompt for the "Hey,

25:28 do you want to allow this tool?" which is, you know, yeah.

25:30 Um do you see the bug?

25:33 No.

25:34 It's okay cuz you didn't know much about my project.

25:35 I didn't know what your project was, so [laughter] I can't see the bug.

25:37 It was supposed to color the ground plane plane green and the player blue.

25:42 Okay.

25:42 And it was fascinating is it did I think it Oh, dear.

25:46 It has two bugs.

25:48 Yeah, it says in the in the description I colored it with Yeah,

25:51 it thinks it did it.

25:54 material.

25:53 Um what's fascinating, too, is it didn't do the hierarchy stuff.

25:56 Oh, it just made it green.

25:58 had it do this before.

25:59 So, I've had it I ran through this demo like three times.

26:01 It did it all three times.

26:02 Mhm.

26:03 Of course, the one time you What did I say?

26:05 The demos were going to break?

26:06 You said the demos were going to break.

26:07 I was.

26:08 Uh it's what happens.

26:09 Okay.

26:09 I'm not going to put all the blame on the update, but

26:16 [laughter] We had a false start.

26:16 Um all right, so um I'm going to say the player Since I can't spell.

26:22 The player and ground are not colored green and blue.

26:27 Fix this and take a screenshot to validate.

26:31 And I'm going to tell it yes to enable all permissions.

26:33 Now, the reason I said take a screenshot is one of the tools

26:35 that the MCP has is the ability to take editor screenshots.

26:39 And it can actually take it from the camera

26:41 in the in the editor or the scene view, I should say.

26:43 And then it can take it from top down and the side views.

26:46 So, it can actually do that.

26:49 the the normal like level editing kind of screenshots to see each perspective.

26:53 Yep.

26:53 And then it it can do that to validate what it's done.

26:56 What it's supposed to have done.

26:57 That's cool.

27:02 And now look at the reasoning on this.

27:05 It's coloring it.

27:06 Yep.

27:07 It's saying, "Oh, I didn't do this right.

27:09 I I didn't I must have messed it up." And so it's

27:12 able to use the MCP to get some information about the scene.

27:15 Yes.

27:16 Cross-check that with what you wanted it to do and then fix it.

27:21 Yeah.

27:23 Uh and this is actually the exact same thing that it did the last time.

27:25 It set the wrong uh property on the material.

27:28 And that's why it had failed.

27:29 Uh so we're going to say I can't spell the word hierarchy.

27:31 Uh h i e r a r c h y And then

27:37 so I'm trying to get it to trigger the skill, ideally.

27:40 Mhm.

27:40 With this.

27:42 You know what's nice about um Mhm.

27:44 Copilot?

27:45 What?

27:46 And LLMs?

27:47 What?

27:48 They understand your spelling mistakes.

27:50 This is true.

27:50 Cuz you misspelled the the word "and" in your first Did I?

27:53 You did.

27:54 I'm not surprised.

27:54 going to tell you.

27:55 I'm not surprised.

27:56 I wanted to see it just you know what?

27:58 Crash and burn.

27:59 But you know what?

28:00 It didn't cuz it's smart.

28:02 It knows what you want it to do.

28:03 It did know what I wanted.

28:05 Uh we can see it's it's saying it's re-parenting.

28:07 So when you're when I've got um Oh yeah, cuz look.

28:10 Now it's using your uh The skill.

28:12 From the skill, it changed the names

28:14 of those objects to kind of make that hierarchy.

28:17 Exactly.

28:18 Okay.

28:18 Yep.

28:19 Um and like I said, the first time I did this, it it did it all.

28:22 I didn't I didn't I didn't have to do that part.

28:23 You didn't have to guide it.

28:24 Mhm.

28:24 Not at all.

28:25 I did have to do the the material thing.

28:28 All right.

28:28 So let's do the next prompt.

28:30 And this is I think I called them coins,

28:32 but these are basically putting six collectible

28:34 objects that are going to be using spheres

28:36 all around um I'll click into Unity here so we can hopefully see it happen.

28:40 But all around the ground plane.

28:42 So I specifically said ground plane.

28:45 Got you.

28:46 Ground plane.

28:46 And so it's going to the scene, find the ground plane, Mhm.

28:49 and then kind of check its dimensions, and create those objects there.

28:53 Yep.

28:53 And it should set the color in theory properly because it knows what

28:57 Now it knows how to correctly set color.

28:59 Yep.

29:01 All right.

29:01 So we can see Some spheres have appeared.

29:06 Yeah.

29:05 Some quote unquote coins.

29:08 Coins, yeah.

29:08 Aren't they cute?

29:09 Uh you also though it says, "Now let me take a screenshot to validate."

29:12 Okay.

29:13 So now it's going to go check to make sure that this color is correct.

29:15 They're around.

29:17 Yep.

29:17 Validated.

29:18 if we zoom zoom in and then let's let's go ahead and click one.

29:23 Oh.

29:23 And we can see it's got the collider on it.

29:25 Uh the other thing I had asked it to do and let's uh

29:29 I don't know where my Let's bring the inspector up so we can see.

29:37 So if we click on it, I said and enable it as a trigger.

29:40 Okay.

29:41 And so that means the player can walk through

29:43 can actually collide with it and cause it to do some action.

29:46 Exactly.

29:48 All right.

29:48 Let's add in the next prompt which is

29:50 going to be around creating the player movement script.

29:53 Ooh.

29:53 So now we're getting into coding.

29:55 Yes.

29:55 Okay.

29:56 That sounds good.

29:58 I like code.

30:00 [laughter] Just the way I said that.

30:03 I was like, you know what?

30:05 expression, too.

30:06 It's perfect.

30:08 excited.

30:10 So the problem here is it needs a domain

30:12 reload with the code that I just added in.

30:14 Oh.

30:15 Cuz that a code that's going to change what it needs

30:18 to generate auto generate and attach and then put all that in there.

30:21 So you have to trigger it yourself or can the MCP do that?

30:24 No.

30:24 It thinks it can.

30:25 Um but at least last I checked, I don't know in this latest update

30:28 that just happened today if that was added in.

30:30 I added That was one of the first things I added in my custom tool that I

30:33 made was the ability to do a domain reload so it so it could do it.

30:37 Got you.

30:37 Um but if you have like the Unity up then it'll do it.

30:40 So that's actually something I I want to flag um because

30:43 I've run into the AI where it's going and it's making script

30:47 changes and uh it gets into this loop of trying to fix

30:51 something that's not actually broken because

30:53 the domain reload just didn't happen.

30:55 So, it yeah, it's making a change.

30:58 It needs a domain reload, doesn't realize it,

31:00 and then it gets confused because it it expects to see something,

31:05 but it's not there because the domain didn't load.

31:07 Yeah.

31:07 So, it seems like this one realized, "Oh,

31:08 I have a domain reload issue." But, um sometimes it'll figure

31:12 it out and then it'll actually stop itself and be like,

31:13 "Hey, human, go uh domain reload and let me know

31:16 when that's been done." And other times it'll just go,

31:18 "It's broken." And then it goes into like this silly spiral.

31:21 Yeah, spiral of trying to fix it.

31:23 Yeah, it's you got to be there with it.

31:25 You're it's your buddy.

31:26 It's your programming buddy, your designer buddy.

31:28 You got to get in there and Yeah.

31:30 You know, the part of why this um I guess set of prompts is going,

31:35 you know, so well uh is I was very descriptive in the prompts, right?

31:39 I told it, "Hey, this is the size of the ground plane that I want."

31:42 some planning.

31:43 Yeah.

31:43 You need to do planning.

31:44 Yeah.

31:45 Okay.

31:45 Yeah.

31:46 Okay.

31:50 So, it got past the domain reload and what it's

31:51 doing right now is looking at uh player input stuff.

31:55 Okay.

31:55 To make sure that everything's hooked up properly.

32:00 All right, so it thinks the task is complete.

32:02 Let's go into Still check it.

32:04 and see.

32:06 All right, so you're going to start the game up Yep.

32:07 and test it.

32:08 Yes.

32:09 Nice.

32:10 Testing, 1 2 3.

32:13 All right, camera's in a terrible spot, so we'll move it.

32:15 All right, so I have player movement.

32:18 Nice.

32:19 Yeah.

32:19 But, no no coin logic.

32:22 No, we haven't added that yet.

32:23 Oh, Mr.

32:24 Blue can't pick up his coins.

32:26 So, let's actually tell the Let's actually Let's bring this out

32:29 of game mode so we can see the the scene.

32:32 And we'll tell the AI um change the camera framing so

32:36 that it's um what's the word I'm looking Top down, bird's eye.

32:40 No.

32:42 I so metric.

32:44 Isometric.

32:45 I think bird's eye view too is the same.

32:47 Is it?

32:47 I think so.

32:49 Cuz that's top It's not top down.

32:50 Bird's eye view is kind of isometric.

32:53 All right.

32:53 So I'm telling Depends on which area era you were born in.

32:58 [laughter] Uh you're not that much older.

32:59 What does Google Maps tell me it is?

33:03 All right.

33:03 So I'm telling it change the camera framing so

33:04 that it's an isometric with the ground plane frame.

33:07 Got you.

33:08 So now it's going to go check that out, check the camera.

33:11 Mhm.

33:12 Try to change it.

33:13 Yep.

33:14 And hopefully succeed.

33:15 And throw an error.

33:17 So it's having trouble rendering the scene view.

33:19 I'm not sure why, but it's still trying.

33:22 It says it's already set to isometric.

33:25 So what it's trying to do is figure out the framing of the camera itself.

33:28 Okay.

33:29 So let's see if we go into game view.

33:32 Oh.

33:33 Yeah.

33:33 We did it.

33:34 Uh yeah, isometric.

33:36 Yeah, that might be the difference between bird's eye view and isometric.

33:39 What were you thinking?

33:40 I'm obsessed with it.

33:41 I want to know what it is.

33:42 What's the difference?

33:43 going to go back to perspective.

33:44 And then um I could go back to the AI,

33:47 but I'm just going to bring this down a little.

33:52 Sometimes we are smarter than the computers.

33:54 Yeah.

33:54 I mean it did a good job.

33:55 It put it generally in the right area.

33:58 Okay.

33:58 We have one more prompt.

33:59 That's the logic for picking up the coins, air quote coins.

34:03 All right.

34:03 So this last prompt again is just going to be about making that C# script.

34:08 We'll clear this air out.

34:09 To do the collection.

34:10 the collections.

34:11 Yep.

34:11 So once this is done, we should be able to walk the player through those coins.

34:16 Coins.

34:18 [laughter]

34:18 To pick them up, and then it should print out uh the number in the console.

34:23 I want to while this is going on and reloading domain and stuff,

34:27 I want to critique something or ask a question I guess.

34:31 So when you give it the instruction to get those coins down there?

34:36 Yeah.

34:35 How come those ones look like they're pretty well distributed

34:38 and then there's one that's way off to the side?

34:40 Well, I just told it to do something random.

34:41 Okay.

34:41 Yeah.

34:42 I wasn't sure if you No.

34:44 like said, you know, do this and put one over there,

34:46 but you said random cuz they seem pretty

34:48 evenly distributed around the player, which is funny.

34:50 No, I think I mean, they're close to it.

34:52 They're not exactly.

34:54 So, I'd have to double-check my prompt because at one point I

34:56 actually did have it say something around like go in a circular motion.

35:00 Okay.

35:00 I was like and then I I was walking through the demo and I was like, "Ah, yeah,

35:03 I didn't like that." So, then I said, "Oh,

35:04 add four more." And it just made four more of them.

35:06 And then I was like, "Do them randomly." And then I thought,

35:08 "I'm going to just change the prompt to be your random." [laughter] Okay.

35:12 All right.

35:13 Um okay, so it says that it did it.

35:15 Let's have a play and see.

35:17 Let's see.

35:20 I like that it tells you describes the code like, "Okay,

35:22 I did this on and trigger enter comparing for the player."

35:26 All right, I've got player movement.

35:28 And I picked up Ooh, coin.

35:29 And we can see it down below.

35:32 I'm also zoomed in.

35:33 I don't know why we're zoomed in.

35:33 There we go.

35:35 All right.

35:36 Cool.

35:36 So, there we go.

35:38 There is a little prototype Coin muncher.

35:42 You know, that's not the name.

35:43 No, that's not the name.

35:45 Uh it's a better name than what I had, which was coin collector.

35:47 So.

35:48 Yeah, I like muncher better.

35:51 Yeah.

35:51 I don't I don't I don't like that.

35:53 All right, I think that's about it, isn't it?

35:56 [laughter] Yes.

35:56 Yeah.

35:57 All right.

35:57 Yeah.

35:58 Um so, hopefully this was a good

35:59 getting started guide on real hopefully not just

36:02 the Unity MCP, but also getting going with GitHub Copilot and kind

36:06 of good practices for I I just I cannot stress enough the instruction files,

36:10 the custom agents, the skills.

36:12 Mhm.

36:12 If you're not being successful with it, then customize it.

36:15 Yeah, which just customize it.

36:18 Just customize it.

36:18 Yeah, just customize it.

36:19 And MCP's, cool.

36:21 Unity MCP, really cool.

36:24 Yeah.

36:24 I think you you've told me in the past

36:26 you you've used it for like testing stuff, right?

36:28 Yeah.

36:29 Like I hey I did you know I I did a bunch of scene.

36:32 Now have the the Unity MCP with AI

36:36 and you tell it hey go walk through the scene,

36:37 go find all these objects, go collect them, tell me what happened.

36:40 Yes.

36:41 So I got so carried away with MCP this past week.

36:45 I created a We don't have time to talk about it.

36:48 No, we're going to.

36:48 Okay.

36:48 I created a bunch of custom tools.

36:50 So there's three that I think are really cool.

36:53 One is the domain reload.

36:54 So it can Oh, do it for itself without you

36:57 Yeah, I got really annoyed at having to constantly do it for it.

37:00 And then the second is I actually enabled it so that it could

37:03 take a a screen capture from the game camera in the game view.

37:08 And why this is really important is because now it can see what the player sees.

37:11 Got you.

37:12 Instead of the editor's camera view.

37:14 was really important for user interface stuff.

37:16 Yeah.

37:16 And so with those things and then I added the ability

37:19 for it to inject device input in runtime for the game.

37:24 So you're not actually just saying hey MCP move this object.

37:27 You're saying now push the forward button.

37:29 Yeah.

37:29 Oh, okay.

37:29 Yeah, but it goes in it uses the existing MCP tools to understand

37:32 what my setup is cuz I use the input the new input system.

37:36 And so it kind of understands it.

37:37 And yeah, so it can inject hold down W for you know X seconds or whatever

37:41 and then I use that just to see like hey could I get this thing to like test?

37:44 It can't do anything insanely complicated right now, but it was pretty cool.

37:48 That's cool.

37:49 Yeah.

37:50 So anyway, so there's a lot of fun I think that can be had with this thing.

37:53 Nice.

37:53 I like it.

37:54 Yeah.

37:54 All right.

37:55 Well, thanks for watching guys.

37:56 Thanks for joining us.

Study with Looplines Download Captions Watch on YouTube