ISerializationCallbackReceiver

There are two methods to this unity engine interface, used in InventoryItem.cs. In what circumstances are they called?

I understand that its implementation is to make sure item scriptable objects always have a GUID. But Serialization seems to refer to a lot of things in Unity. When / how often is this method called?

I’ve read the unity docs but they’re a bit terse on the subject, and their use case doesn’t have much in common with this one.

Thanks!

I’ve just realised there’s content on this subject five videos down the line :joy:

I keep having this feeling that something isn’t going to be explained, because of the explanation in the course introduction about “not writing code line by line anymore” so I go through all the .cs files beforehand to see what’s going on.

Hopefully I’ll get used to this new teaching dynamic :grinning_face_with_smiling_eyes:

We only used this format of teaching for this course. It wasn’t as well received as we expected (which is ironic, because during the recording of the Core Combat, this format was what students felt we should go to).

The ISerializationCallbackReceiver is used by the Editor whenever any data is changed or updated in a GameObject or ScriptableObject. It’s mainly used to allow a hook into the data stream to interpret data from one form to another, or to enforce limits/validate data (yes, we also have OnValidate for some of this).

We take advantage of it in the InventoryItem to ensure that we always have a valid ItemID.

1 Like

I think it’s alright, less hand holding is the way to go, but there is a danger of the student feeling as if they’ve been chucked into the deep end suddenly lol

Some of us like the deep end. :slight_smile:

It’s generally easy for a new coder to identify as a beginner, and somebody who started coding before Ronald Reagan insisted that Mr. Gorbachev tears down a wall to identify as advanced. Intermediate is a grey area, and it’s harder to identify whether that’s the category for you.

For a beginning student, one starts to feel some confidence and bravado. Laser Defender went well, and you had a good understanding of the mechanics.

The advanced student, meanwhile, has a pretty good grasp on coding and understands how Unity works, and they don’t want to simply type what the instructor is typing.

Both look at an intermediate course with different expectations. The beginning student still needs a bit more one on one time typing what the instructor types, so Core Combat hits their expections well (we really did try to make that course so you could be 1/2 way through the 2D or 3D course). The advanced student gets bored, probably already typed out an acceptable solution in the challenge and just wants to get on with it, show me the code and I’ll reconcile it with my code. When we did the Core Combat, a lot of our backers said “Hey, we’re not beginners, why are we still doing it this way? Here’s my life jacket, let’s dive in there!”. Meanwhile a lot of beginners were taking the course, and quite successfully.

On to Inventory, where this feedback was applied, and the format we have for the course is more of an interview between a senior programmer and an apprentice. We also felt it was vital that students learn to read and understand code written by others (this is, IMO, one of the telling signs that you are at the higher end of the intermediate spectrum.) so a lot of focus was placed on explaining how to read code, and less time was spent typing things out from the ground up. This approach actually went well with the upper intermediate and advanced students, but it did leave a lot of students feeling left behind. Lesson learned, we went to more of the “follow me” approach for the later courses, even though they dive into significantly more upper intermediate lower advanced concepts. That approach seemed to go well, overall.

As always, our mission is to leave no students behind, so I’m here whenever there is an issue in any of our RPG courses to guide folks along and get them through the next challenge (and I’m always willing to explain any part of the codebase in any of the RPG series courses.)

1 Like

It’s good to know that learning to read others’ code is important and on the higher end of intermediate, because that’s precisely the toughest part of this course for me :dizzy_face:

my day job is teaching English so I had an intuition with learning to code that “reading code” or “code literacy” is just as important as “learning to write code”, but I didn’t really imagine how important it actually might be.

It’s tough, but it’s pretty rewarding :grinning_face_with_smiling_eyes:

Also, I think the solution to students feeling overwhelmed with this type of course is precisely to have strong community support where you can get individualized help

Being able to read code written by others is an essential skill, especially in the team environment. Not only that, I’ve learned over the years that reading code I wrote 5 years ago is code written by others. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms