Serialize Reference, Serialize Field, Serializable and Scene Serialization in Unity | Unity Tutorial

  Рет қаралды 8,212

Game Development Beyond the Basics

Game Development Beyond the Basics

Күн бұрын

Пікірлер: 65
@slodoco
@slodoco 8 ай бұрын
Yes, please make that finite state machine in inspector video!
@Catalyst8487
@Catalyst8487 2 күн бұрын
This was such a great video to easily explain a complex topic. Liked, subscribed, bells a plenty. Thanks for the video!
@m-horth2187
@m-horth2187 9 ай бұрын
Great video! Even being at a level where I'd typically say "yeah of course I know how [SerializeField] works..", this step-by-step testing along with checking the scene file really helps shed some light on what's actually happening, and cements it all together. The later tips in the video about [SerializeReference] will come in handy for some projects I have in mind. Thanks!
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 9 ай бұрын
Great to hear!
@thomaselliott7174
@thomaselliott7174 Күн бұрын
This video was very helpful, thank you so much!
@TimTheMain
@TimTheMain Ай бұрын
You are one of the clearest explainers out there. You should definitely make more vids you are a natural.
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics Ай бұрын
Thank you! I just got back from my honeymoon so I should be able to resume working on videos on a more regular schedule now. :)
@christianskwisgaar
@christianskwisgaar 9 ай бұрын
I love your explanation. Sometimes we forget how things works.
@machinaexphilip6871
@machinaexphilip6871 9 ай бұрын
wow. finally a great overview with depth and a calm explanation. Thank you!
@hermanusjohannesbesselaar2499
@hermanusjohannesbesselaar2499 9 ай бұрын
Thanks. This really helped me understand serialized fields a lot better. Hope to see a lot more videos from you!
@dustin.2498
@dustin.2498 9 ай бұрын
We need you!!!!! As a beginner, you are the only one who can help a person like me to escape the tutorial HELLLL!!!! Great video, btw.
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 9 ай бұрын
With that kind of attitude you'll be out of Tutorial Hell in no time!
@iiropeltonen
@iiropeltonen 10 ай бұрын
Excellent explanation. Thank you.🎉
@nicolas29031
@nicolas29031 9 ай бұрын
Great explanation. Subscribed. Keep it up! It would be awesome to see the finite state machine!
@Benndot97
@Benndot97 8 ай бұрын
Such a great explanation! I keep coming back to this as I learn Unity and run into these concepts
@problem1O1
@problem1O1 8 ай бұрын
Finally I know the serialized Reference use case.
@birahe1810
@birahe1810 10 ай бұрын
Again, amazing explanation. Would love to see you explain FSMs. It would be really helpful
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 10 ай бұрын
Thank you! I've added FSMs to the list. It might be a bit of a wait before I get to the video since it will require more pre-production than my other videos. It will be a great topic though!
@Canals03
@Canals03 9 ай бұрын
First video youtube recommended that's actually really good
@xXBl0oD
@xXBl0oD 9 ай бұрын
Clear and compact explanation! Looking forward for more future video from you!
@ImmortalTimothyM
@ImmortalTimothyM 9 ай бұрын
Great video, I have subscribed.
@mehmedcavas3069
@mehmedcavas3069 5 ай бұрын
this just saved my game I think. in the past I used structs to save data with enums for types. thanks to this I can create normal classes and now they are serializable which allows me to turn them in to json's easier and save them. Plus I can easily test and setup things in the editor. this extension must be a default important thing in unity
@kormsd
@kormsd 3 ай бұрын
omg i love you dude the SerializedReference just opened my eyes and saved me hollyyyy
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 3 ай бұрын
Glad to hear it! SerializeReference is such a great tool to have in the toolbox.
@AmedDuman
@AmedDuman 9 ай бұрын
Great video! Please continue to making these beyond the basics videos. Great concept really.
@mertakbulut241
@mertakbulut241 3 ай бұрын
Crystal clear. Thank you sir.
@foo3268
@foo3268 9 ай бұрын
I'm surprised that a completely random video was able to solve an issue I was having like a week ago haha. I sacrificed some generics and abstracts due to the very situation you've showed. But perhaps I can reimplement them using some of these attributes. Awesome video, really clean explanation.
@mathboy8188
@mathboy8188 9 ай бұрын
... the video I wish had existed when I first started learning Unity.
@ValorieAF
@ValorieAF 15 күн бұрын
There's also the Odin Inspector / Serialization package. Yes, it's a paid asset, but it's extreeeeeeemly useful especially for more complicated serialization. You can also serialize collections and dictionaries easily (this is not an ad).
@schizoscope8703
@schizoscope8703 25 күн бұрын
Great explanation! Thank you!
@melted-snow-q9o
@melted-snow-q9o 4 ай бұрын
underrated video, how has this just 405 likes after 6 months?
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 4 ай бұрын
Thank you! The topic is fairly specific so this isn't really a video someone watches for fun nor something beginners would care about. I think a video like this will just linearly grow over time though since it's always going to be relevant. Also, this was my second video and I had about 15 subs when I uploaded it, haha.
@LuciusFilmex
@LuciusFilmex Ай бұрын
Great video, thx!
@TheMystogrigen
@TheMystogrigen 13 күн бұрын
[field: SerializeField] public float number {get; private/protected set;} the private/protected is optional too! Great for satisfying Abstracts or Interfaces with a Getter, and no need to make it readonly or pointing at an additional private/protected variable.
@Crackoder
@Crackoder 9 ай бұрын
Nice tutorial and thanks for the tool, not sure what I'd use it for yet, but I think its great to setup stuff on the inspector that way
@SonnyMakesGames
@SonnyMakesGames 9 ай бұрын
Livesaver, thank you!
@elyastigre9867
@elyastigre9867 9 ай бұрын
Thank you I would LOVE to know more about your state machine, even more if the quality of the video matches this one !!
@Sakach1
@Sakach1 7 ай бұрын
Please make a finite state machine, I want to learn the advance topic more keep up the good work! much appreciate
@nameno7032
@nameno7032 6 ай бұрын
Worked with Unity for years, but still don't understand the Serialize Reference feature. Thank you for another beyond the basic tutorial.
@HickyGreen
@HickyGreen 9 ай бұрын
thank you :)
@tomiczdarko
@tomiczdarko 9 ай бұрын
Love it! Subbed!
@ep1417
@ep1417 6 ай бұрын
Finite state machine from this topic is what I would like to see.
@epicmcdude
@epicmcdude 9 ай бұрын
This is really cool, dude! I'm very curious to know how you do saving and loading with Samurai Unicorn, because while there are plenty of tutorials that show how to save basic items, none show how to save for a feature game. Items that get spawned in the scene, scenes full of references, saving enemies various states/animations/pathing etc. I don't know if that's a video you'd be down to making!
@TH3Willster
@TH3Willster 6 ай бұрын
I was having a lot of trouble trying to serialize ValueTuple. Any suggestions?
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 6 ай бұрын
I haven't tried serializing that before, but you can always extend ISerializationCallbackReceiver and try getting it serialized there. The docs have an example about how to do this with a dictionary: docs.unity3d.com/ScriptReference/ISerializationCallbackReceiver.html That said, based on this thread, it looks like people have been requesting the feature for almost 6 years now: forum.unity.com/threads/please-let-a-valuetuple-can-be-serialized.552703/
@pekustudio4935
@pekustudio4935 7 ай бұрын
This music make it from good tutorial to good sad tutorial 😢😆
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 7 ай бұрын
I was going more for calming and peaceful, lol. Too many gamedev tutorials make Unity seem confusing or hard, so I try to go for a Bob Ross vibe instead.
@pekustudio4935
@pekustudio4935 7 ай бұрын
@@GameDevelopmentBeyondTheBasics i didn't mean it's Bad turorial, you did good job and made it simple, its just the music made my eyes wet 😆
@_wagnerdesouza
@_wagnerdesouza 4 ай бұрын
Why you didn't use the SerializableField for the variable ItemName? It's not being saved? The [Serializeble] in the class automatically serialize all the variables in the class?
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 4 ай бұрын
Because it's a public property so it will get serialized, so long as the class it's on is serialized. You can read more specifics of how serialization works in Unity here: docs.unity3d.com/Manual/script-Serialization.html
@PthreeG
@PthreeG 6 ай бұрын
Unity just asked me what I don’t like the most and I said “not enough beyond beginner learning resources”. KZbin must have heard me lol
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 6 ай бұрын
That was my biggest pet peeve as well, haha.
@JackBauerDev
@JackBauerDev Ай бұрын
But why do any of this? Why not just have constants in code?
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics Ай бұрын
Hm, I think there's something fundamental that I must have no gotten across in my video if you're confusing these concepts with constants. Constants are typically just that, constant values. They're mostly used to help make code easier to read and remove hardcoded values (like if the resulting error code from an API call is 404, I know it's not found. I can use a const variable `const int ERROR_CODE_NOT_FOUND = 404` and check against that variable in code). The Unity editor doesn't really deal with constants (for example, in the editor itself, I can't type in ERROR_CODE_NOT_FOUND in an inspector text field and expect it to work) they're really just for use in scripts when coding. Now, the concepts in this video don't have anything to do with constants. The classes being marked as serializable are mutable and can have their values changed in both the Unity editor inspectors at both edit and runtime, or in a script. Serializing custom classes has an endless amount of uses, and I do give a few examples in this video like with my finite state machine being made up of serialized classes that represent the states which allows me to edit the values in both the Unity editor and scripts. This is also useful when dealing with more complicated data sets. Take enemy health for example. If all you need to store is CurrentHealth and TotalHealth, then it would be overkill to create a custom serialized class that represents these two values. However, if you're making a more complicated fighting game where individual limbs can be damaged, then it makes sense to create a serialized LimbHealth class to encapsulate values like CurrentLimbHealth, TotalLimbHealth, IsBroken, etc, and then the Health component can have a collection of LimbHealths for the various arms and legs of the character. This way your Health component won't need to have a dozen variables like RightArmIsBroken, LeftArmIsBroken, RightLegIsBroken, etc. It can juts look at the LimbHealth for the specific limb in question and check IsBroken. And now, because LimbHealth is a serialized class, any changes made in edit mode will be saved like regular values are, and you can see the list of LimbHealths show up in the inspector and make changes to the values right there. The other serialization attributes like SerializeReference are for more advanced use cases like having a base LimbHealth class, but then have child classes of ArmLimbHealth and LegLimbHealth and have extra functionality (like ArmLimbHealth might have variablesa for CanPunch, CanHoldWeapon, etc and LegLimbHealth might have variables for CanWalk, CanRun, CanKick, etc). Hopefully this long winded explanation clears things up. Serialization is more of an intermediate level concept but extremely useful when making more advanced games. Feel free to ask other questions if you need something clarified.
@MehmetSarkd
@MehmetSarkd 8 ай бұрын
I wanted to sub when I saw the channel's name. Do you plan to upload?
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 8 ай бұрын
I would love to have you subscribe! I'm currently wrapping up a video on playing a one off AnimationClip from code (not needing it set up as a state in an AnimatorController). The video is meant as an introduction to the Playables API (the thing Animators and Timeline is built on). I hope to have that video out today or at the very least sometime this weekend.
@MehmetSarkd
@MehmetSarkd 8 ай бұрын
@@GameDevelopmentBeyondTheBasics I subbed. it is hard to find advanced unity tutorials
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 8 ай бұрын
New video is out now: kzbin.info/www/bejne/p4G0nHmPqZymo80
@littleface7060
@littleface7060 10 ай бұрын
No offense but your hair is quite distracting Maybe wear a hoodie or something idk
@GameDevelopmentBeyondTheBasics
@GameDevelopmentBeyondTheBasics 10 ай бұрын
I am sorry you can't handle my luscious curls :) I'm hoping with better lighting my hair doesn't flicker with the green screen as much.
@macawls
@macawls 9 ай бұрын
I for one think his hair looks magnificent
@rize2137
@rize2137 9 ай бұрын
Maybe it's just a case with the lighting :)
@nekonyo660
@nekonyo660 9 ай бұрын
QuoteAllPositiveComments(); Thank you !
The answer is...
7:40
Jason Weimann (GameDev)
Рет қаралды 13 М.
Why you should NOT make everything PUBLIC!
8:26
Code Monkey
Рет қаралды 121 М.
How many people are in the changing room? #devil #lilith #funny #shorts
00:39
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 6 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 18 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 14 МЛН
Play an Animation Clip Without an Animator Controller State | Playables API | Unity Tutorial
25:15
Root Motion + NavMeshAgent (and Nav Mesh Links!) | Unity Tutorial
23:38
Game Development Beyond the Basics
Рет қаралды 10 М.
If You Can't Make Games After This Video...
4:37
Fredyy
Рет қаралды 1 МЛН
11 Things You (Probably) Didn't Know You Could Do In Unity
13:49
Game Dev Guide
Рет қаралды 156 М.
134 Unity Components EXPLAINED in Less than 30 Minutes
24:01
This is GameDev
Рет қаралды 72 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 734 М.
Serialize Types in the Unity Editor using Reflection
11:50
git-amend
Рет қаралды 7 М.
How many people are in the changing room? #devil #lilith #funny #shorts
00:39