Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:03,280 --> 00:00:07,960
So in this video, we're going to once again use the profiler and we're going to take a look at our
2
00:00:07,960 --> 00:00:08,780
scripts.
3
00:00:08,830 --> 00:00:12,640
So if you click on CPU usage and we're now just going to press play.
4
00:00:12,970 --> 00:00:17,650
I'm going to leave this going for a while until we get enough characters on the screen that we can analyze.
5
00:00:18,920 --> 00:00:24,280
OK, might even do a little bit shooting in order to kill off some of these characters.
6
00:00:27,460 --> 00:00:31,210
We also get some kind of change in of positions and that kind of thing.
7
00:00:31,600 --> 00:00:37,090
And then suddenly I'm going to click let's click about here where we've got this tiny little spike once
8
00:00:37,090 --> 00:00:40,330
again, does the 1000 frames per second line.
9
00:00:40,400 --> 00:00:41,860
It's definitely nothing to worry about.
10
00:00:42,460 --> 00:00:44,920
But then if you click all those, you can see it change.
11
00:00:44,920 --> 00:00:46,990
And that's where we get our 60 frames per second.
12
00:00:47,680 --> 00:00:51,970
As I say, this this part, the others, is mostly influenced by the editor.
13
00:00:52,570 --> 00:00:57,790
OK, so where we have this timeline drop down the change to hierarchy.
14
00:00:58,000 --> 00:01:03,280
OK, the hierarchy shows you all the different loops going on, all the different processes.
15
00:01:03,970 --> 00:01:06,470
And some of these like from the camera.
16
00:01:06,490 --> 00:01:11,740
Some of them are internal functions and all the way down here.
17
00:01:12,420 --> 00:01:17,770
Ed Loop is basically what's going on inside of our editor at the moment that's taking up 10 percent
18
00:01:17,770 --> 00:01:21,760
CPU time, flush and collect edit stats.
19
00:01:21,790 --> 00:01:23,320
OK, that's taking up this much.
20
00:01:23,980 --> 00:01:30,910
Our main player loop, which is what's going on inside the game, is taking up 80 percent of the process
21
00:01:30,910 --> 00:01:31,330
of time.
22
00:01:33,040 --> 00:01:33,850
Time update.
23
00:01:34,030 --> 00:01:35,500
Wait for last presentation.
24
00:01:35,740 --> 00:01:41,590
Basically, that 60 frames per second cap that we put in there is currently taking up seventy to seventy
25
00:01:41,590 --> 00:01:45,640
six point two percent of our processing time.
26
00:01:46,060 --> 00:01:46,390
All right.
27
00:01:46,390 --> 00:01:49,120
Because we're simply waiting for frames per second.
28
00:01:49,930 --> 00:01:57,370
So if I switch that off, go back in once again in the script, in the main script, switch off the
29
00:01:57,370 --> 00:02:00,100
application target frame, right click save.
30
00:02:01,660 --> 00:02:06,100
Let's just wait for that to finish and then we'll compare the difference.
31
00:02:11,460 --> 00:02:14,280
OK, once again, just let it get going a little bit.
32
00:02:17,360 --> 00:02:24,740
Just do a bit of interaction here and then click say about here.
33
00:02:25,280 --> 00:02:26,840
OK, let's take a look.
34
00:02:26,870 --> 00:02:35,750
So now Play a Loop is taking up just eighteen point five percent, and Ed Loop is now taking up seventy
35
00:02:35,750 --> 00:02:36,830
eight point two percent.
36
00:02:36,830 --> 00:02:38,570
That's that's jumped up to the top.
37
00:02:39,320 --> 00:02:40,820
Update Scriptorium.
38
00:02:40,820 --> 00:02:41,750
Behavior update.
39
00:02:41,750 --> 00:02:43,100
Behavior update.
40
00:02:44,000 --> 00:02:45,950
There's not even a cap now.
41
00:02:45,950 --> 00:02:47,210
It's not even telling me that.
42
00:02:47,210 --> 00:02:48,830
It's waiting for a frame update.
43
00:02:49,490 --> 00:02:54,440
Willis is here taking up 0% percent, OK, because there simply isn't one.
44
00:02:56,150 --> 00:02:56,480
All right.
45
00:02:56,480 --> 00:02:58,490
So that's that's the other issue.
46
00:02:59,030 --> 00:02:59,420
All right.
47
00:02:59,420 --> 00:03:01,370
So we know exactly what's causing that now.
48
00:03:03,170 --> 00:03:09,350
And so a good idea if you find like an issue is taking a huge amount of processing time and it's near
49
00:03:09,350 --> 00:03:10,300
to the top of the stack.
50
00:03:10,340 --> 00:03:16,580
You need to find out what's causing it and understand whether that is necessary for the game, which
51
00:03:16,580 --> 00:03:20,420
in this case, it is so that you can run the optimal speed on the mobile device.
52
00:03:21,650 --> 00:03:21,940
OK.
53
00:03:22,010 --> 00:03:29,060
So once again, we're just going to press play and take a look at what else is causing any kind of issues.
54
00:03:36,440 --> 00:03:41,660
OK, maybe get one of these some particles.
55
00:03:42,360 --> 00:03:43,040
There we go.
56
00:03:43,340 --> 00:03:45,680
All right, so just click on here.
57
00:03:46,280 --> 00:03:49,130
So our time wait for update.
58
00:03:49,160 --> 00:03:50,030
Don't worry about that.
59
00:03:50,210 --> 00:03:55,430
Player loops come back up to the top now and it's only taking 555 point nine percent now.
60
00:03:55,940 --> 00:03:58,420
So notice you will get very different results.
61
00:03:58,430 --> 00:04:04,910
And each time you play, depending on how long you been playing, the longer you play, the more the
62
00:04:04,910 --> 00:04:07,190
play loop is going to take up processing time.
63
00:04:07,580 --> 00:04:11,450
This is the reason why if you've been playing the game for a while on the mobile, you'll notice it
64
00:04:11,450 --> 00:04:12,950
starts to kind of slow down a bit.
65
00:04:13,400 --> 00:04:19,280
And that's because the whole thing is eating up, but it's also using more elements.
66
00:04:19,340 --> 00:04:24,560
And the longer you place the play, a loop is getting bigger and bigger in terms of processing time.
67
00:04:25,940 --> 00:04:32,350
A camera render is then the next one that's obviously rendering all of the items drawing COLLING date
68
00:04:32,360 --> 00:04:33,920
in any lights, even though there aren't any.
69
00:04:33,920 --> 00:04:34,700
So zero.
70
00:04:35,900 --> 00:04:42,290
And if you have any post-processing that would show up there and the camera image effects, but there's
71
00:04:42,290 --> 00:04:43,380
no post-processing.
72
00:04:44,060 --> 00:04:50,150
Then we get our update script Wrong Behavior, which is currently taking up just one point four percent
73
00:04:50,360 --> 00:04:51,470
of the processing time.
74
00:04:51,470 --> 00:04:52,820
So that's really, really small.
75
00:04:53,600 --> 00:04:54,290
She's great.
76
00:04:54,590 --> 00:04:58,070
It's only in terms of millisecond zero point three, two milliseconds.
77
00:04:58,970 --> 00:05:05,300
So our behavior update is made up of our event systems, and then we move script, which is attached
78
00:05:05,300 --> 00:05:06,260
to all of our enemies.
79
00:05:06,650 --> 00:05:11,600
Our main update, which is attached to the ground, and then this frames per second count.
80
00:05:12,500 --> 00:05:12,920
OK.
81
00:05:13,690 --> 00:05:17,930
And any updates, as you can see, is running on 12 enemies.
82
00:05:18,050 --> 00:05:19,880
It's being called 12 times.
83
00:05:20,480 --> 00:05:21,410
Let's take a look at these.
84
00:05:21,440 --> 00:05:27,680
Notice, in terms of times in milliseconds, it's only taken up zero point zero two milliseconds.
85
00:05:28,220 --> 00:05:29,630
It's extremely small.
86
00:05:30,020 --> 00:05:30,380
All right.
87
00:05:30,380 --> 00:05:31,580
So that's really good.
88
00:05:32,000 --> 00:05:33,300
Definitely no problems there.
89
00:05:34,020 --> 00:05:39,910
And yeah, everything is looking good there.
90
00:05:39,920 --> 00:05:40,340
OK.
91
00:05:40,970 --> 00:05:43,340
This first one, this event system update.
92
00:05:43,490 --> 00:05:50,000
Let's take a look at this, because this is taking zero point to seven milliseconds.
93
00:05:50,660 --> 00:05:59,180
So let's try and find out exactly where that's coming from, from the standalone input module and.
94
00:06:02,040 --> 00:06:09,930
It's mostly on this one, this first one standalone import module, so it's basically the mouse states,
95
00:06:09,930 --> 00:06:10,590
the imports.
96
00:06:10,920 --> 00:06:16,680
It's it's this effectively it's the joystick control and the shooting and the buttons.
97
00:06:17,250 --> 00:06:20,130
That's what's taking up the majority of the time.
98
00:06:20,550 --> 00:06:22,200
But it's such a minuscule amount.
99
00:06:22,200 --> 00:06:23,700
It's definitely nothing to worry about.
100
00:06:25,290 --> 00:06:32,580
It's just simply one point two percent of the processing time and frames per second counter update.
101
00:06:33,480 --> 00:06:35,070
For some reason, switch that off.
102
00:06:35,430 --> 00:06:38,790
Let me take a look on the canvas.
103
00:06:40,260 --> 00:06:41,370
No, we've got it going.
104
00:06:41,790 --> 00:06:43,830
Interesting, but it's not using anything.
105
00:06:44,490 --> 00:06:46,050
OK, I'll come back to that shortly.
106
00:06:46,170 --> 00:06:47,670
It does have one caller with us.
107
00:06:47,880 --> 00:06:48,370
Zero.
108
00:06:48,870 --> 00:06:50,940
And main update.
109
00:06:51,060 --> 00:06:51,960
Let's take a look.
110
00:06:53,130 --> 00:06:54,420
It's being called twice.
111
00:06:54,420 --> 00:06:58,200
This is what's moving our parent object and our main camera.
112
00:06:59,670 --> 00:07:01,850
And so it's twice and.
113
00:07:04,100 --> 00:07:05,520
Yeah, extremely small.
114
00:07:05,540 --> 00:07:07,910
I mean, in terms of milliseconds, we're looking at zero.
115
00:07:08,390 --> 00:07:11,480
It's that fast is running really, really good.
116
00:07:12,260 --> 00:07:15,740
OK, our fixed update physics is basically going to be moving.
117
00:07:15,770 --> 00:07:25,340
Our zombie characters using A.I. and everything else is less than zero percent.
118
00:07:27,100 --> 00:07:31,850
OK, so in terms of optimization, that is extremely optimized.
119
00:07:33,170 --> 00:07:38,170
The Ed Loop is obviously only going to be running while you're in unity, Ed..
120
00:07:38,630 --> 00:07:43,490
Forty three percent of processor time will completely disappear when you're on mobile.
121
00:07:44,570 --> 00:07:44,990
OK.
122
00:07:45,320 --> 00:07:45,860
Excellent.
123
00:07:47,630 --> 00:07:51,080
Now, there should be some kind of garbage collection.
124
00:07:51,500 --> 00:07:57,090
And on the canvas, when we got our frames per second counter running, the frames per second count
125
00:07:57,150 --> 00:07:59,750
should be creating some garbage collection.
126
00:08:00,430 --> 00:08:02,630
And I actually want to see that running.
127
00:08:02,810 --> 00:08:11,900
And so what I'm going to do, going to leave this plane for a while and see if it shows up on the garbage
128
00:08:11,900 --> 00:08:12,470
collection.
129
00:08:13,950 --> 00:08:15,030
Got this big spike here.
130
00:08:15,050 --> 00:08:18,320
This is the this is the start when the game started again.
131
00:08:22,920 --> 00:08:23,370
Really?
132
00:08:25,190 --> 00:08:26,740
Test everything, basically.
133
00:08:27,350 --> 00:08:30,890
Oh, I've got zombie on the floor is not getting destroyed, that was weird.
134
00:08:37,520 --> 00:08:39,380
Well, he's seen reload.
135
00:08:40,030 --> 00:08:41,600
Let's wait for that level of achieved.
136
00:08:41,750 --> 00:08:43,150
We go reloaded again.
137
00:08:43,850 --> 00:08:45,110
We look at our small local.
138
00:08:50,410 --> 00:08:53,530
And few things showing up on the screen here.
139
00:08:54,550 --> 00:08:55,360
OK, good.
140
00:08:59,830 --> 00:09:04,510
We've got a pretty big spike here with ice falling below 30 frames per second.
141
00:09:05,170 --> 00:09:08,830
And now let's take a look at our.
142
00:09:11,100 --> 00:09:11,920
Oh, OK.
143
00:09:11,980 --> 00:09:13,560
Say no garbage collection.
144
00:09:13,860 --> 00:09:19,680
Normally the frames per second count does create a lot of garbage in garbage is effectively where it's
145
00:09:19,680 --> 00:09:26,490
creating new variables that are getting stored temporarily that need to be cleared out of memory.
146
00:09:26,880 --> 00:09:33,970
OK, and where we've put something like, wait four seconds and we've initialize them here at the beginning
147
00:09:33,970 --> 00:09:38,070
and start is much more effective than trying to create them.
148
00:09:38,700 --> 00:09:42,660
And down here whereby we say yield return equals.
149
00:09:42,930 --> 00:09:49,170
And then we create a new wait for seconds that will create garbage in, garbage in to.
150
00:09:49,170 --> 00:09:51,030
But until it gets cleared.
151
00:09:51,420 --> 00:09:56,460
When garbage gets cleared, that can cause a big spike in performance that can limit your frames per
152
00:09:56,460 --> 00:09:56,970
second.
153
00:09:59,730 --> 00:10:05,190
And but, yeah, overall, it's been playing for a while, it's even loaded to scene a couple of times
154
00:10:05,200 --> 00:10:13,850
and our update Scriptorium behavior is only taken up zero point five percent of processing time play
155
00:10:13,860 --> 00:10:16,200
a loop is only at twenty seven point one percent.
156
00:10:17,370 --> 00:10:19,320
So I think everything is really, really good.
13984
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.