ScriptableObjects, Explained | Unity Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 34

  • @retroman7581
    @retroman7581 7 หลายเดือนก่อน +4

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

  • @Sarishie
    @Sarishie 5 หลายเดือนก่อน +2

    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

  • @Josh-gb9ml
    @Josh-gb9ml 2 ปีที่แล้ว +4

    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 ปีที่แล้ว +1

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

  • @SatisfyingNerd
    @SatisfyingNerd ปีที่แล้ว +2

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

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      Thank you for the compliments 🙌

  • @FictitiousCtrlGames
    @FictitiousCtrlGames 2 หลายเดือนก่อน

    Your hair looks very early 2000's late 90's and I'm all for it, sir.

  • @poobagification
    @poobagification 2 ปีที่แล้ว +3

    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.

  • @BatuhanTerzi1
    @BatuhanTerzi1 2 ปีที่แล้ว +3

    you are an awesome teacher

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      Thank you I appreciate that 🙏

  • @Tooni8282
    @Tooni8282 2 ปีที่แล้ว +1

    Well explained mate!

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      I appreciate that! Thanks!

  • @Bananenbauer123
    @Bananenbauer123 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

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

  • @darkman237
    @darkman237 7 หลายเดือนก่อน

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

  • @FictitiousCtrlGames
    @FictitiousCtrlGames 2 หลายเดือนก่อน

    So, I'm still not sure what the point of scriptable objects is.
    Wouldn't it save more on resources to just use a prefab with all the data stored in it?

    • @LlamAcademy
      @LlamAcademy  2 หลายเดือนก่อน

      It's more memory efficient to store nonchanging build-time data in SOs or variables that multiple things need in an SO.
      One example might be if you have something like "float AttackSpeed" for a particular type of enemy. It is likely you want all enemies of this type to use this value. Perhaps you even have multiple enemy prefabs for this one enemy type that have different models or are special instances for special levels.
      In this case having an "Attack Config Scritpable Object" that houses the AttackSpeed (and likely more) that all of these objects can reference and use. In memory it's just 1 float instead of 1 float per enemy instance.
      I don't think in this video I got into it much, but It's much more convenient to deal with configurations this way from an editor tooling perspective than dealing with prefabs.

    • @FictitiousCtrlGames
      @FictitiousCtrlGames 2 หลายเดือนก่อน

      @@LlamAcademy Ah okay. That makes sense.

  • @SGUDevs
    @SGUDevs หลายเดือนก่อน

    couldn't you add abstract in scriptable object and if you wanted to change base add override to change the logic for a created SO enemy or whatever is being created from base

    • @LlamAcademy
      @LlamAcademy  หลายเดือนก่อน

      Yup, you could

  • @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: th-cam.com/video/mntS45g8OK4/w-d-xo.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

  • @ytubeanon
    @ytubeanon ปีที่แล้ว

    sounds like SO's are templates

  • @kingpic
    @kingpic 4 หลายเดือนก่อน

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

    • @chakibchemso
      @chakibchemso 4 หลายเดือนก่อน

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

  • @monkeyrobotsinc.9875
    @monkeyrobotsinc.9875 10 หลายเดือนก่อน +1

    constantly looking up plus ringlight and glasses equals super annoying.

    • @LlamAcademy
      @LlamAcademy  10 หลายเดือนก่อน

      Thanks

    • @crtglowgames
      @crtglowgames 10 หลายเดือนก่อน +1

      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. 🙄