Mismatch between code of course and one used in gitlab saving portion

Hello. I am wondering when we actually should use the updated json saving version because I was working on health and noticed in the commits that Brians code in health.cs was completely different. Further more that he had it in a namespace called “assets” which we didnt use up to this point. Was this folder structure changed during the original savesystem portion of the course? Another example is healthPoints.value is impossible since with the code we have up to this point, our variable healthPoints is just a float. I would very much appreciate to be informed in which order I should do this. Should I make the “unsafe” implementation first and THEN go with the Json solution? I want to go with the Json solution asap since I want to be able to learn how to make safe code.


When I wrote the Saving System patch, it was from the perspective of the completed course. This is the reason for the healthPoints.value vs the healthPoints. In a later lecture, we’ll be converting healthPoints from a float to a LazyValue<float> (in a class we’ll introduce at that lecture). For now, just using return healthPoints; is fine. Once you get to the LazyValues, you’ll change it to healthPoints.value;

Which class was in the assets namespace? I can’t seem to find that in the repo.

I’ve added some notes to the tutorial explaining that the repo is based on the state of the course project at the end of all four courses, and that some namespaces and folder locations have changed from the Core Combat course.

The important focus is on the code presented in the tutorial itself. I also put a note about the LazyValue immediately after the Health.cs code

Thank you kindly. I’ll finish the original course and then return to your solution. I think that will be the easiest for me and for anyone else following along


My bad I see now thatr the Assets folder is just something that Unity comes with as standard. However I do notice the Attributes folder inside the Scripts folder thats not present up to this point in the course. I assume its something we add when we convert healthPoints?

Actually, it’s because when Sam put the Health in the Resources folder/namespace in “Looking up the Health Stat”, he forgot that this actually puts the scripts in Resources as well (via the Resources.Load mechanism).
It started in Core
Then Combat (what a silly place for it!)
Then Resources (which made sense on paper)
It was ultimately moved to Attributes.

If I’d had had my druthers, would have been in Vitals (as in Vital statistics). That’s probably because at my age, I spend a great deal of time getting my vitals checked in Dr. visits. :stuck_out_tongue:

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

Privacy & Terms