Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,560 --> 00:00:03,260
Debugging is an extremely important skill to have.
2
00:00:03,530 --> 00:00:08,029
When you implement gameplay logic, many things won't go as planned and you're often not sure why things
3
00:00:08,029 --> 00:00:08,990
don't work out.
4
00:00:09,500 --> 00:00:13,400
So instead of always having to ask others, you need to be able to look into the blueprints and figure
5
00:00:13,400 --> 00:00:14,990
out what's wrong by yourself.
6
00:00:15,730 --> 00:00:19,870
There are many different ways we can debug our game, but the easiest and most commonly used one is
7
00:00:19,870 --> 00:00:22,090
Printstring, which we already used before.
8
00:00:22,420 --> 00:00:28,210
We actually already did a little bit of debugging here by printing a string when the cast fails.
9
00:00:28,360 --> 00:00:32,650
Print strings can be very useful to show you which path of execution your nodes are taking.
10
00:00:33,670 --> 00:00:37,570
Print strings can also be very useful for showing us which values are being used.
11
00:00:38,920 --> 00:00:43,690
For example, before we set the speed increase of this instance only to 5000.
12
00:00:43,690 --> 00:00:50,140
So let's say we play the game and we notice that this one makes us faster than the others, and we forgot
13
00:00:50,140 --> 00:00:52,090
that we set it to a different value before.
14
00:00:52,150 --> 00:00:58,060
One way to debug this would be to go in here and before increasing the speed, or after increasing the
15
00:00:58,060 --> 00:01:00,760
speed, putting in a print string.
16
00:01:02,230 --> 00:01:05,110
And here we can print the value of the speed increase.
17
00:01:07,570 --> 00:01:10,870
Now we can see that here we get 500, 500.
18
00:01:10,870 --> 00:01:13,660
And if we touch this we get 5000.
19
00:01:13,660 --> 00:01:19,690
So this shows us that something is going wrong and we're getting a different value than we expected.
20
00:01:19,960 --> 00:01:23,980
So now that we know that we're getting a different value than expected for speed increase, we can check
21
00:01:23,980 --> 00:01:25,150
the variable here.
22
00:01:26,070 --> 00:01:28,230
And we can see that the default value is 500.
23
00:01:28,230 --> 00:01:29,730
So everything looks fine here.
24
00:01:29,730 --> 00:01:32,550
But we can also see that it's instance editable.
25
00:01:34,210 --> 00:01:39,250
And this will give us a hint that somebody maybe changed a value here, which we actually did before.
26
00:01:39,280 --> 00:01:42,280
So to debug, we can now just put it back to 500.
27
00:01:42,280 --> 00:01:45,760
And we just use print string to solve a problem that we had.
28
00:01:46,880 --> 00:01:49,820
And of course, for this example, this was something we created ourselves.
29
00:01:49,820 --> 00:01:53,480
But many times something will go wrong that you just don't know what's going on.
30
00:01:53,780 --> 00:01:57,920
However, as you become more experienced, there's also many other debugging methods you can use.
31
00:01:58,310 --> 00:02:02,750
For my Beatmap game, I made overhead labels that always show the current state of the character.
32
00:02:08,870 --> 00:02:13,790
This helped me get rid of issues such as the character not getting up anymore or being frozen in place.
33
00:02:15,860 --> 00:02:20,390
So instead of just asking somebody right away, try to figure out the issue yourself first by using
34
00:02:20,390 --> 00:02:21,320
print strings.
35
00:02:21,740 --> 00:02:24,890
In the next chapter, we're going to go over the paper 2D basics.
3722
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.