Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (SoranĂ®)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1 1
[MUSIC] 2
2
Hello again, welcome to our instructor hangout. 3
3
We've got Ben with us here. 4
4
Good day Ben. 5
5
It's been a while since we've seen you. 6
6
How have you been doing? >> Good day Rick. 7
7
How are you doing sport? 8
8
I'm fine mate, thank you very much. 9
9
I've been away for a little trip so I'm back now and 10
10
looking forward to helping out. >> Cool, cool. 11
11
So what we're gonna go through in this video is, we're gonna go through some of 12
12
the things that we've dug into throughout this section and 13
13
get Ben's take on what we've been doing. 14
14
I said at the start of this course it's good to hear things from different 15
15
perspectives, angles. 16
16
So we're gonna get Ben to give us his take on what we've been doing. 17
17
And the first thing I wanna dive into is a good meaty conversation. 18
18
We've had some questions about state versus state versus state and so 19
19
we use the word state about 1,000 times. 20
20
And a little bit of why have we got state state? 21
21
What does that mean? 22
22
Just to touch on that and to get your thoughts, Ben, on how do we know, for 23
23
example, that we can access our public method in the state class. 24
24
What in here is telling us that we can access that? 25
25
But first, a really quick note when Ben and I were goofing around, 26
26
we've commented out this line of code just while we're experimenting and talking. 27
27
Don't comment out that line of code, 28
28
don't follow what we've done with that particular line. 29
29
Leave it as it is, you don't need to comment it out. 30
30
Okay, back to it. >> Okay, so first thing I want you to pay 31
31
attention to the coloring, here, and the capitalization. 32
32
So state state is saying that we wanna make a variable called state with a small 33
33
s and is of type state. 34
34
Now why are we calling it state state, why use the same word twice? 35
35
Simply because as you get more experience, 36
36
you will use the same word twice because your eye will be attuned to two things. 37
37
To the capitalization, which of course we're hoping that you are nice and 38
38
good people and make your actual things, your instances, with lowercase. 39
39
But the thing that's more robust than that is looking at this blue. 40
40
This state is in blue, just like text is in blue here. 41
41
All these things that are in blue are types of things. 42
42
Input is a type, key code's a type. 43
43
All these things are types. 44
44
So it's a variable of type state and they both happen to have the name state. 45
45
So- >> Cool, great. 46
46
>> That's that bit. 47
47
>> Very good. 48
48
Yeah, excellent. 49
49
So that's one part and then the next part is, 50
50
I've seen a couple of questions in the Q and A about why does this work? 51
51
Why can we say that our TextComponent.text we're calling our 52
52
method from our state class over here. 53
53
Why is this state effective in allowing us 54
54
to call this method? >> Well over in state.cs, 55
55
if you pop over there for a second, we've said that when we make these state things, 56
56
which for the moment I understand that you guys haven't got the detail 57
57
of exactly what a class is. 58
58
And a lot of these details you're gonna have to. 59
59
Remember how pictures used to load on the Internet? 60
60
They were fuzzy and then they get sharper and sharper and sharper. 61
61
And now the Internet is so fast that they just appear, but they used to go fuzzy, 62
62
then sharper, sharper, sharper. 63
63
That's the way we're teaching you. 64
64
We're not teaching you line by line, right. 65
65
Because the reason images used to do that is cuz you kind of got an overview really 66
66
quickly and you could scroll down the page if you weren't interested, same here. 67
67
So we're giving you the overview, 68
68
then we're gonna drill into the detail on successive approaches. 69
69
So what we're doing here in this other class, 70
70
is we're saying that it's public, a public method 71
71
called GetStateStory is available to anything that is a state instance. 72
72
So we have this state class in blue. 73
73
I've done it in red, but you get the idea. 74
74
And then we make ourselves a little state variable here. 75
75
It's now on this state variable we can say, .Get.StateStory etc. 76
76
All right, so that's whats going on there. 77
77
The reason that you can say back in your Adventuregame.cs 78
78
class .GetStateStory is because the State, 79
79
this State here is this word here and it is of typestate. 80
80
Because it's typestate it has this public method on it. 81
81
So, that's kind of all you need to know at the moment. 82
82
Well, unless there's another question. >> Excellent, no, that's good for now. 83
83
And you were saying we haven't dug a lot into class and 84
84
in upcoming sections we're gonna dig into that a bit more or a lot more I guess. 85
85
We're gonna dive into that a bunch. 86
86
There's also a conversation that we've been having throughout this whole section 87
87
that's been about scriptable object. 88
88
And there's been some great questions about the notion of here is 89
89
game as a game object. 90
90
And we can see very clearly we've got our script attached to it. 91
91
So that brings the script into existence. 92
92
That makes the script come alive, 93
93
cuz it's attached to this GameObject as an instance. 94
94
Whereas this script here, state, is just hanging out. 95
95
But let me give ourselves a bit more screen real estate here. 96
96
When we create our scriptable objects, you can see that the state script, 97
97
the state class, is sitting on this asset file here. 98
98
Do you wanna give us your take on what's going on here from a different 99
99
direction? >> Yeah, so 100
100
let's take it from the direction of where things are on the disk to keep it simple. 101
101
So over on this GameObject anything you do on that is being stored in the scene file. 102
102
So that is just in your scene file which will be in this folder over here. 103
103
So anything you're doing there's stored in this scene until you get into prefabs 104
104
which we'll get into later, which are prefabricated objects. 105
105
So when you make the changes that, store them there. 106
106
Now, when it comes to these files down here, all of these state files that we've 107
107
created, the point is, is what it's saying in the inspector here is, firstly, 108
108
when you make one of these you're just making a file on the disk. 109
109
You can see it here. 110
110
It's in a cell.asset, it's A2 in a cell.asset. 111
111
So when you make one of these, you're literally just make a file on the disk. 112
112
And the template that that file is based on is defined by this state script that 113
113
we made. 114
114
So the state is just the template for it. 115
115
It's like the form you're filling out basically. 116
116
And then here is the form showed to you in the inspector. 117
117
It gives you options to both specify texts and to link to a couple of other states. 118
118
So that's what's going on there. 119
119
You're making a file on the disk to a given template. 120
120
The template is the state.cs script of an object class. 121
121
It's a template for storing information in. 122
122
Just like a Google form or a Wufu form or a SurveyMonkey form. 123
123
It's just a form. >> Yep, cool. 124
124
And in your opinion, Ben, 125
125
when should we be looking beside let's just jump to scriptable objects? 126
126
At this stage people are going through the course and not yet 127
127
familiar with how do I make decisions, how do I problems solve? 128
128
One of the things that I've been hitting on is let's teach you how to 129
129
problem solve. 130
130
What's a nugget that we can be giving people at this point, 131
131
in terms of when they should be thinking, 132
132
scriptable objects would be a good idea from my project versus I don't [INAUDIBLE] 133
133
scriptable objects at the moment? >> Okay, so two answers I think to that. 134
134
Number one is you won't know yet. 135
135
If you're brand new to coding and you're following a 3D, 136
136
you don't have enough experience yet. 137
137
So step one is watch us do something, right? 138
138
Step two is start to follow along with us. 139
139
Step three, later on and 140
140
the learning journey you'll be to be able to make those decisions for yourself. 141
141
So don't expect to be able to make that decision yet, 142
142
we're just introducing you to a possibility, right? 143
143
And then to answer more specifically, when you start to wanna watch out for 144
144
that type of stuff is in code you should never have magic numbers. 145
145
We've started to talk about that. 146
146
Any number that's not zero, one, or two probably shouldn't be in code. 147
147
Even two is questionable because it's some sort of number that contains information. 148
148
It's the number of days of the week. 149
149
It's something else. 150
150
So that should be a parameter to your code. 151
151
It should be something that you use to change the way your code works, 152
152
not buried deep inside the code file. 153
153
And the same goes for words and strings of text, so 154
154
putting all the story text in the code has a couple of problems with it. 155
155
Firstly it obfuscates, it makes unclear how the code works. 156
156
And the other thing that it does is that if I'm working on a CS file, a C# file 157
157
trying to make the game do something, behave in certain way, somebody else can't 158
158
simultaneously work if you wanna work with a partner on creating the story text. 159
159
Because they'd be clashing on the same file, and 160
160
we'd have a lot of trouble reconciling those changes. 161
161
So that's kind i the bottom line as to why we're using them here and 162
162
we wanna introduce you to them really early. 163
163
Uncomfortably early for me in the design of this course to introduce it to you. 164
164
But the point is that, if we do that and as you move forward, 165
165
you'll start to question whenever you create a new script. 166
166
In the future, in about three sections time, 167
167
you'll be ready to start questioning, I'm making a new script. 168
168
Should it just be what comes out the box by default, 169
169
which is more on behavior thing which is just what comes out the box. 170
170
Should it be a scriptable object, which we'll try to see now or 171
171
should it be something else which we'll cover later. 172
172
So that's the point, 173
173
it's to get you in the habit of questioning the type of script that Unity 174
174
just automatically gives you. >> Yeah, that's a really great point about 175
175
multiple people working on it, cuz you might have a friend you teamed up with. 176
176
The friend's gonna be the story writer and 177
177
you're gonna be working on the functionality, for example. 178
178
And the friend can be in there creating all sorts of great story and states and 179
179
flow and not at all impacting the fact that you're in here working on the script 180
180
and getting some functionality into the game. 181
181
It's pretty cool. 182
182
Another thing that Ben and I were talking about just before we turned 183
183
on the camera was our bracketing, our braces and where things fits. 184
184
So I wanna touch on that just very briefly Ben. 185
185
What's important at this stage and what's not important at this stage in your 186
186
opinion for people to be focused on when it comes to the layout to white space, 187
187
to their formatting? >> So this is an interesting one. 188
188
It's a bone of contentions. 189
189
So it's a marmite point. 190
190
Either you love it or you hate it. 191
191
One thing actually matters is how the compiler in service that code. 192
192
Now I'd really like you to be able to read code even if it's not perfectly formatted, 193
193
otherwise when you even go to Unity sample code it may not be perfectly formatted. 194
194
If you find other people's code on the web, it's not gonna be perfectly 195
195
formatted, there is no perfect, but it may not be consistently formatted, all right. 196
196
Now what you're seeing on the screen here is not currently consistently formatted, 197
197
but it's okay, let go of it. 198
198
Yes, of course, we should have a consistent coding style and yes, 199
199
of course, it's good if we stick with a perfect and consistent code style. 200
200
But to do that you have to learn as Rick says, to change the template, and 201
201
what gets spat out in terms of this code with start and update, 202
202
there's spaces between the method name and the brackets here but there aren't here. 203
203
This curly braces here rather than here, relax, its okay. 204
204
It all works in C#, it's all white space, it doesn't care, 205
205
we know it's not 100% consistent. 206
206
We, in the future of the course, will think about changing the template and 207
207
really tightening that up. 208
208
But the first thing you need to do is let go of perfect code formatting before you 209
209
then start fully owning it, in my opinion. 210
210
Cuz first you need to make a decision about what code style do you 211
211
want to employ. 212
212
There is no one code style that is the right code style, 213
213
it's what's right for you. 214
214
And secondly, you need to be not allergic to other people's code. 215
215
You need to get in the habit of suppressing that urge to say, 216
216
it's not right. 217
217
And remember there's no right or wrong, there's just styles. 218
218
It's not consistent, it's not good, but 219
219
you need to get able to read code that is inconsistently styled. 220
220
Otherwise, when you come to solve bigger problems later, where you wanna copy and 221
221
paste or at least you're inspired by other people's code, if you can't get over the, 222
222
it's not perfectly consistent, you can lose out on a lot of value that other 223
223
people have created. >> Yeah, that's a great point. 224
224
As you were talking I've just gone and formatted this to our preferred 225
225
formatting, which is not to have any space between the update and the brackets here, 226
226
and to have our curly braces on the next line. 227
227
But there's a lot of people who prefer to do things like that, 228
228
and they both work. >> Yeah, absolutely. 229
229
[CROSSTALK] So strive for consistency in the code you write but 230
230
forgive inconsistency in others. >> Excellent, really good. 231
231
The other thing I wanted to hit on in this instructor hangout is there are some part 232
232
of the design in this section that we've gone through pretty fast, for 233
233
example how to write a story or how to come with a story idea? 234
234
Or how to connect from one state to the next state. 235
235
We've gone through that pretty quickly cuz we just don't have time in this course to 236
236
dig too deep into design. 237
237
People are here to learn programming, they're here to learn Unity, and 238
238
they're here to learn how to make a game from start to finish. 239
239
So we skipped some of that, and hopefully, we'll have a narrative design course. 240
240
If you really want one then make some noise and 241
241
we'll put that on the agenda to create one of those. 242
242
But I've deliberately not spent too much time on that throughout this section cuz I 243
243
know we just don't have time to dig into it too much. 244
244
>> Awesome, well thanks for 245
245
being with us guys. 246
246
Do dive over to the community side and share your biggest takeaway, 247
247
at least your biggest single takeaway from this instructor hang out. 248
248
Let us know if you like these instructor hang outs, hopefully you do and 249
249
we look forward to seeing you in the upcoming content.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.