ScriptableObjects, Explained | Unity Tutorial

Learn the power of Scriptable Objects! In this tutorial video you'll learn about some of the awesome things you can do with ScriptableObjects. From saving memory, enabling configuration-driven games, and more!
Scriptable Objects are hugely powerful tools that Unity provides to us to make our lives easier!
💸 Ongoing sales 💸
⚫ See all active asset sales on the Asset Store: assetstore.unity.com/?on_sale...
⚫ Save 25% off your first Asset Store Order: prf.hn/click/camref:1101l9QvC...
⚫ Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
👨‍💻 As always, all code from this video is available on GitHub: github.com/llamacademy/script...
❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Patreon Supporter or KZread Member:
⚫ Patreon: / llamacademy
⚫ KZread Member: / @llamacademy or click the Join button on any video
----
Most tutorials come from knowledge gained making survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.
I also have some Unity Assets (affiliate link): assetstore.unity.com/publishe...
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment
Chapters:
00:00 What the heck are Scriptable Objects Anyway?
00:48 #1 Use Case (according to Unity)
01:42 Creating Scriptable Objects
04:33 What Data Should Go into a Scriptable Object?
08:33 Using ScriptableObject Data in a MonoBehaviour
10:23 Using ScriptableObjects with Components You Don't Control (NavMeshAgent, for example!)
14:14 Dangers of Modifying ScriptableObjects in the Editor
17:10 Recap!

Пікірлер: 28

  • @Sarishie
    @SarishieАй бұрын

    i've watched a lot of people discussing about scriptable object, i never understand what case it can be use for, but i watched this video, and it gives me an idea about how to use it, and i've been used scriptable object since then, thank you Liam academy, thanks, love you, wish all your dream can become true

  • @retroman7581
    @retroman75813 ай бұрын

    Great explanation! You deserve way more attention for your tutorials, they are great :)

  • @Josh-gb9ml
    @Josh-gb9ml2 жыл бұрын

    I wanted to watch this just to make sure I'm not missing any cool tricks or creative uses of SO's since your videos are always so chalk full of little golden nuggets of information. And sure enough I was exposed to code and ideas that have inspired me to dig deeper and learn new things. Your channel is a hidden gem man I could probably find hours and hours of footage about scriptable objects on youtube and I doubt any of them would even come close to being as useful as this video was. Cheers friend

  • @LlamAcademy

    @LlamAcademy

    2 жыл бұрын

    🤗 thank you! I really appreciate that! You brightened up my day!

  • @SatisfyingNerd
    @SatisfyingNerd Жыл бұрын

    You know how to deal with beginner! You deserve a job on big company. Thank you!

  • @LlamAcademy

    @LlamAcademy

    Жыл бұрын

    Thank you for the compliments 🙌

  • @poobagification
    @poobagification2 жыл бұрын

    this did a good job of formalizing a lot of the patterns I've been using with SOs. I'll probably adopt the naming scheme since I've had the same issue with naming collisions.

  • @batuhanterzi407
    @batuhanterzi4072 жыл бұрын

    you are an awesome teacher

  • @LlamAcademy

    @LlamAcademy

    2 жыл бұрын

    Thank you I appreciate that 🙏

  • @Tooni8282
    @Tooni82822 жыл бұрын

    Well explained mate!

  • @LlamAcademy

    @LlamAcademy

    2 жыл бұрын

    I appreciate that! Thanks!

  • @Bananenbauer123
    @Bananenbauer1232 жыл бұрын

    Really amazing video and kind of blew my mind. It is so much more intuitive for a designer to drag and drop "Attacks" or enemy "stat sheets" into a given enemy prefab. It also makes sense becaues enemies/enemy types pretty much always start out with some sort of "static" base value. Even in the case that an enemy's health needs to be scaled in some fashion we can throw in values like baseHealth and/or healthScalingFactor.. into the scriptable object and bam. You can have sets of values in a neat sheet and if you ever change your mind on an enemy's stat balance you can simple switch it out for the older version without having to retype values in code. Now, one question perhaps regarding the permanence of the data. Changes to scriptable objects are always permanent, correct? So those could be used for saving some of the most recent changes to say, player health. This could be quite useful for preventing alt f4 quitouts from playres to revert their own death or stuff.

  • @LlamAcademy

    @LlamAcademy

    2 жыл бұрын

    Changes to the ScriptableObjects persist in the UNITY EDITOR ONLY (regardless of play mode or edit mode). On a deployed device any changes will not be persisted through runs of the game! Once a player restarts the game, they will lose any changes made from the previous run. To retain changes in a build you'd have to persist this in a database, a file in Application.persistentDataPath, or remotely on some server.

  • @Bananenbauer123

    @Bananenbauer123

    2 жыл бұрын

    @@LlamAcademy Ohh I see. Still quite useful for base values. Thanks for the reply!

  • @darkman237
    @darkman2373 ай бұрын

    So how do you access the sub classes later? Enemy/Boss/Major Boss , Enemy/Boss/Minor Boss , Enemy/Boss/Final Boss , Etc.

  • @pierepaul2387
    @pierepaul2387 Жыл бұрын

    Please can you make a video on how to save scriptable objects data using a savesystem.

  • @LlamAcademy

    @LlamAcademy

    Жыл бұрын

    Hi! An important piece in this video is that you do not generally create ScriptableObjects at runtime. You would not use ScriptableObjects in a Save System. Instead you should use Serializable Classes like in this video: kzread.info/dash/bejne/n6KotZZul5u1e5c.html

  • @pierepaul2387

    @pierepaul2387

    Жыл бұрын

    @@LlamAcademy Thank you soo much, but I have made a save system already, the problem is I don't know how to save data of my weapon (which is a scriptable object) as I upgrade my weapons level, fire rate and reload time. BTW, I watched the video already thank you.

  • @LlamAcademy

    @LlamAcademy

    Жыл бұрын

    In that case, you should be able to serialize your ScriptableObject's properties into your save system and deserialize them back into a ScriptableObject on load. Is that not working for some reason for you?

  • @pierepaul2387

    @pierepaul2387

    Жыл бұрын

    @@LlamAcademy I havent seen a video for that

  • @LlamAcademy

    @LlamAcademy

    Жыл бұрын

    It's the same concept. The ScriptableObject is just a C# class that is serializable. You mark the ScriptableObject as [System.Serializable] and do JsonConvert.DeserializeObject. You may have to do something like make a fully serializable class because I’m not sure if you can simply do new YourScriptableObject() which is what the Json Serializer will do

  • @kingpic
    @kingpic21 күн бұрын

    This video content: your face 98%. Scriptable objects 2%.

  • @chakibchemso

    @chakibchemso

    8 күн бұрын

    um, no if you actually listen then you'll get more information than you'd from a copy paste code video.

  • @ytubeanon
    @ytubeanon Жыл бұрын

    sounds like SO's are templates

  • @monkeyrobotsinc.9875
    @monkeyrobotsinc.98756 ай бұрын

    constantly looking up plus ringlight and glasses equals super annoying.

  • @LlamAcademy

    @LlamAcademy

    6 ай бұрын

    Thanks

  • @crtglowgames

    @crtglowgames

    6 ай бұрын

    If nothing else that, er, 'constructive' new comment may have bumped your video up the algorithm, as it was recommended to me today. Great video, with useful real-world examples, thanks. And the light wasn't remotely annoying to me for what it's worth. 🙄

Келесі