The Ultimate Introduction to Scriptable Objects in Unity

Поділитися
Вставка
  • Опубліковано 31 лип 2024
  • In this video I'll introduce you to ScriptableObjects (SOs), show you what they are, how they work, how to make one, and why you should use them.
    ᐅGet the full Source Code Bundle to my Unity Tutorials 🤓
    sam-yam.itch.io/samyam-full-s...
    📥 Get the Source Code 📥
    / 61460588
    🤝 Support Me 🤝
    Patreon: / samyg
    Donate: ko-fi.com/samyam
    Try out Machinations for FREE today!!
    👉machinations.io/?...
    ►🔗 Relevant Video Links 🔗
    ᐅUnity Forum - ScriptableObject behaviour discussion (how Scriptable Objects work)
    forum.unity.com/threads/scrip...
    ᐅScriptable Object API Unity Documentation
    docs.unity3d.com/ScriptRefere...
    I go over the Scriptable Object creation, instantiating them through code dynamically, showing the functions you can call within them, and will mention additional uses with them such as event based messaging and replacing enums. I will be making another video going more in-depth with the event based messaging. Scriptable Objects are scene and play-mode independent assets that live in the project scope and are used to contain data. This makes it great for rapid iteration for both developers and designers and allows for easier testing due to reduced dependencies (can isolate testing features).
    Small Fix, in the video I said to put SerializeField and a private setter, but make sure to add the field tag as so
    [CreateAssetMenu]
    public sealed EnemyData : ScriptableObject
    {
    [field: SerializeField]
    public Int32 MaxHealth { get; private set; } = 100;
    }
    ►⏱️ Timestamps ⏱️
    0:00 Intro
    0:38 Machinations Sponsorship
    1:55 What are Scriptable Objects
    3:47 How to make a Scriptable Objects
    7:11 Enemy Scriptable Object Example
    11:16 Scriptable Objects Overview
    11:53 Scriptable Object Functions and Execution Order
    14:47 Instantiate Scriptable Object in Code
    16:33 Event Based Messaging with Scriptable Objects
    17:07 Sidenote - Don't destroy original Scriptable Object
    17:21 Replacing Enums with Scriptable Objects
    19:11 Outro
    💖💖THANK YOU TO ALL MY PATRONS 💖💖
    ❯❯❯ My Links ❮❮❮
    💗 Patreon 💗
    / samyg
    💬 Discord Server 💬
    / discord
    🐦 Twitter 🐦
    / samyam_utube
    📚 Facebook 📚
    / samyam.youtube
    🎵 Music 🎵
    Ambient Gold
    streambeats.com
    👍 Like and Subscribe! 👍
    🖥️ Computer Setup 🖥️
    *As an Amazon Associate I earn from qualifying purchases.
    www.amazon.com/shop/samyam
    Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we have recommended. While clicking these links won't cost you any money, they will help me fund my development projects while recommending great assets!
    #madewithunity #gamedev #unity
  • Наука та технологія

КОМЕНТАРІ • 140

  • @samyam
    @samyam  2 роки тому +65

    Small Fix, in the video I said to put _SerializeField_ and a _private setter_ - but make sure to add the *field:* tag, like so:
    ---------
    [field: SerializeField] // Notice the field: part. Adding this inside any attribute will make it work with Properties.
    // Others you might want to use are [field:Range(min: 0, max: 100)], [field:Tooltip("description")], etc
    public int MaxHealth { get; private set; } = 100;
    ---------

    • @bunnybreaker
      @bunnybreaker 2 роки тому +2

      Wait, what?! I suddenly need to refactor my whole game...

    • @pabloalves
      @pabloalves 2 роки тому

      I didn't know this one... today you taught me two new things.. you got new sub 😁😁

    • @catafest
      @catafest Рік тому

      define NONE? I used IDLE and this aligns with the game logic. After scriptable objects and events, I think the next big issue is the delegate feature. Why don't you make videos about these?

    • @Sam4Progress
      @Sam4Progress 5 місяців тому

      I was on your channel looking for a playslit that included this video but couldnt find one? Did you end up making a playlist or series regarding Scriptable objects as part of another project?

    • @samyam
      @samyam  5 місяців тому +1

      @@Sam4Progress Not really, I do have this intro video though ua-cam.com/video/cy49zMBZvhg/v-deo.html

  • @danielvindhjarta2851
    @danielvindhjarta2851 2 роки тому +98

    This is a good video, and I approve of it, but you forgot a very important part of ScriptableObjects: They can run code. Which means you can use them to alter behaviour of stuff. As an example, you can create different ScriptableObjects for different types of AI, and just switch out the "brain" of an enemy to try out different behaviours. I once made a game where we used ScriptableObjects to alter the behaviour of text, so when the player read to a certain point in the text, stuff such as particle effects, screen shakes or sound could play. This is a very powerful tool for your Designers. You should at least mention that it's possible, although all the possibilities would probably require its own video.

    • @samyam
      @samyam  2 роки тому +41

      That's a good point, I had forgotten to clearly mention it in the video, thanks! I should probably make a separate video on it just because it's such a exhaustive topic after the event based messaging for scriptable objects video 👍

    • @shyamarama
      @shyamarama 2 роки тому +2

      @@samyam That would amazing to see. Would really complement this video as a follow up

  • @neenaw
    @neenaw 2 роки тому +8

    This is by far the best scriptable object video I've seen!

    • @samyam
      @samyam  2 роки тому

      Thank you!! :D

  • @Xxnightwalk1
    @Xxnightwalk1 2 роки тому +14

    The thing I like, is that you mention how important these are when working with designers
    So many tutorials forget that game development isn't just about programmers showing off their programming skills but cooperating with non programmers ( designers, artists, etc... ) and making sure they can work autonomously

  • @onatozdemir
    @onatozdemir 2 роки тому +22

    While I follow and really like your channel, I want to give humble advice. Your tutorials start easy and very understandable, it becomes really hard so quickly. I totally got lost on "Enemy Scriptable Object Example" part.
    Your presentation skills are great, and I really want to learn with your content.
    All the best!

    • @samyam
      @samyam  2 роки тому +6

      Thanks for the feedback! I’ll try my best to avoid doing that in the future :)

  • @FireJojoBoy
    @FireJojoBoy 2 роки тому +2

    This is perfect! I needed a new introduction to scriptable objects lately

  • @BlackPanzerYZ-pq9nd
    @BlackPanzerYZ-pq9nd Рік тому +1

    Samyam, I am Incredibly grateful for your channel's inspiration during tough times. My game is hitting Steam after two years of learning!

  • @Valdyr_Hrafn
    @Valdyr_Hrafn Рік тому

    I loved this video! this was very comprehensive and got me super excited to try it out!

  • @semenshchepkin1333
    @semenshchepkin1333 Рік тому

    this is really the best video about SOs, that i found today)
    thank you so much, waiting for new tutorials in your style :)

  • @AleySoundz
    @AleySoundz 2 роки тому

    Amazing tutorial. Thank you for taking the time to do this.

  • @antontheyeeter
    @antontheyeeter 2 роки тому +4

    i am amazed by how much your channel has evolved. Congrats :)

    • @samyam
      @samyam  2 роки тому

      Thanks Anton! Hope you’ve been well!

  • @marinemanaphy101
    @marinemanaphy101 2 роки тому +1

    Thank you so much for this video! I had a bunch of data in scriptable objects but was struggling to connect them to actual objects in the scene, this was a massive help!

    • @samyam
      @samyam  Рік тому

      Awesome to hear!

  • @Ylaid
    @Ylaid 3 місяці тому

    Thanks for actually showing how to create one unlike all the other videos I have watched where it just explains bunch of stuff instead of showing how to create a scriptable object lol

  • @SuperDutchrutter
    @SuperDutchrutter Рік тому

    Thanks Samyam, super useful video

  • @emilyhorton996
    @emilyhorton996 3 місяці тому

    An ESSENTIAL Unity tutorial. Thanks again for such an awesome video!

  • @kazukixe
    @kazukixe Рік тому

    This is such an amazinly done video so clean and useful and to the point

  • @saadsarnaik
    @saadsarnaik 2 роки тому +1

    Excellent introduction for this topic. Thanks.

  • @TheAgavi
    @TheAgavi 2 роки тому +3

    Easily my new favourite unity tutorial channel. The way your videos are organised is freaking perfect. Most other tutorials are jumping all over the place.

  • @DanPos
    @DanPos 2 роки тому

    Great video as usual! I've been really digging SO's for a while now

    • @samyam
      @samyam  2 роки тому

      Thanks Dan!! 😁

  • @rebarius
    @rebarius 2 роки тому +2

    This woman is a hero ❤️🙌🏼 thank you so much for this Sam ❤️

    • @samyam
      @samyam  2 роки тому +1

      Thank you Rebar! :)

  • @BarcelonaMove
    @BarcelonaMove 2 роки тому

    Your code is so clean it shines. Awesome job.

    • @samyam
      @samyam  2 роки тому

      ✨ ✨ ✨

  • @sdn2pomahan839
    @sdn2pomahan839 Рік тому

    bro thanks so much, you actually made soft soft easy to understand

  • @sergiosdf599
    @sergiosdf599 Рік тому

    Every time I stumble with your channel I read Saiyaman instead of Samyam so, with this and your useful tips I guess.. 🤔you're kinda my hero 😅

  • @markorossie9296
    @markorossie9296 2 роки тому

    This is fantastic, thanks

  • @thesilentwisp
    @thesilentwisp 2 роки тому

    Thank you so much for this.

  • @clavesi
    @clavesi 2 роки тому

    Wonderful tutorial as always!

  • @JH-uv7km
    @JH-uv7km Рік тому

    thanks! helped a lot!

  • @gopalravi6676
    @gopalravi6676 Рік тому

    normally i dont give reviews but maam youre amazing like i tried 2 videos on 2020 and one on 2022 but it wont work but i saw yr video today and it worked as being both content creators i respect your hard work and keep it up

    • @samyam
      @samyam  Рік тому

      Thank you so much I appreciate it!! 😄

  • @kirtanvinodbhaivekariya413
    @kirtanvinodbhaivekariya413 Рік тому

    What an angel! You save my broken head!

  • @jacksonfrederick514
    @jacksonfrederick514 Рік тому

    hanks lot Sir.. You helping us..

  • @jakariarafi9737
    @jakariarafi9737 Рік тому

    TNice tutorials was a fantastic beginner's guide, straight to the point, very clear. As a long-ti teacher I can tell you are quite apt at teacNice tutorialng!

  • @irisdv658
    @irisdv658 2 роки тому

    great video !

  • @kyleme9697
    @kyleme9697 2 роки тому +2

    New subscriber ... I really wish I had seen this video a year ago when I was digging into SOs. This was just so much better, clearer, and contains way more info, than all the other videos I watched last year. Such a simple example but the first part of the video explaining how its an asset really made it pop.

    • @samyam
      @samyam  2 роки тому

      Thanks so much glad you enjoyed it! :D

  • @millerbyte
    @millerbyte Рік тому

    You rock, this is super helpful. Subscribed.

  • @user-tx9kx1yh8f
    @user-tx9kx1yh8f 2 роки тому

    Thank you so much 😊😊😊

  • @faridbehrouzi2380
    @faridbehrouzi2380 Рік тому

    great video thanks a lot

  • @TheKr0ckeR
    @TheKr0ckeR 2 роки тому +1

    Great video! I have a save system with scriptable objects that holds data. So for every object that i want to save, i create a scriptable objects. I watched this video and saw we can create instances of them. So, what my question is that is this going to create instance every time we start playing the game if we use that code in start?

  • @mypetlove1578
    @mypetlove1578 11 місяців тому

    forexample i want to grow tomato, i wrote all scripts required. i just duplicate tomato object in the scene but when i grow 1 of the somato, other also grow at the sametime... so 1 scriptable object will be enough for both of them work independent ?

  • @joshuahauhio5936
    @joshuahauhio5936 Рік тому

    Fantastic video! Subscribed :)

  • @IlaiyaBharathi
    @IlaiyaBharathi 2 роки тому

    Didn’t know they had awake and onEnable. Brilliant video… thank you 😊

    • @samyam
      @samyam  2 роки тому

      Thank you!!

  • @Joe-oq2zn
    @Joe-oq2zn 2 роки тому

    what a great video :D

  • @KillingSurvival
    @KillingSurvival Рік тому

    Good stuff

  • @superdahoho
    @superdahoho 7 місяців тому

    what if you have functions that you need to save as data. like making a game with active/ passive skills that you can use.
    If i store functions how would I execute that from a scriptableObject and apply it to the scene?

  • @Kathayne636
    @Kathayne636 Рік тому

    How do you access the Scriptable Object data without use of the inspector, purely in code? Like if I wanted to get the Goblin Enemy Scriptable Object's Health integer from inside another script?

  • @GRENADEable1
    @GRENADEable1 2 роки тому +8

    I have been using SOs (Scriptable Objects) for all of my projects now (been a year or 2). I use it for the Handling GameManager States such as if the game is starting, running. If the player is dead etc
    I am looking forward to Event-Based SOs as I use Unity Events and C# Events (Delegates and static events) but I have never figured it how it works with SOs.

  • @VLOneWay
    @VLOneWay 2 роки тому

    thx nice video

  • @mmediaculturel3738
    @mmediaculturel3738 Рік тому

    and build tracks from there and leave the rest for a later session. I did both but did the first way initially and it took a day to get through

  • @jmikleo4336
    @jmikleo4336 Рік тому +3

    Great video but I want to clear one thing that scriptable Object are not used for save system, because they don't persist data in build runtime i.e. the game runtime, they persist data only in the editor and any other scene which has reference to that specific scriptable object, if there is no reference to it on other scene the data will lost.

  • @blo0m1985
    @blo0m1985 2 роки тому

    So how actually access that "goblin" parameters? Only main script is accessed in the example.

  • @diliupg
    @diliupg 2 роки тому +1

    Nice creative title.

  • @TheSixoul
    @TheSixoul 2 роки тому +4

    Good video on the basic usage of scriptable objects. One of the biggest things is using them for events. You mention an inventory or save system but I've heard those are actually more complicated than one would think. Do you think it's possible for you to cover those in a future video as well as events?

    • @samyam
      @samyam  2 роки тому +2

      That's a great idea, perhaps I will once I get through some other videos first!

  • @amac333
    @amac333 2 роки тому +1

    I'm going to experiment with a localization system with Scriptable Objects. Would be cool to see your take on this!

    • @walterh2113
      @walterh2113 2 роки тому +3

      It might be good to know that Unity has a built-in Localization System. Though I'm not saying you shouldn't make (a better) one, just be aware of it.
      _com.unity.localization_

  • @Tenaciousanimations
    @Tenaciousanimations 2 роки тому

    In my case I am trying to make a card game whose card effects are very unique per card. I've taken the approach to make each card a unique scriptable object, meaning each card will have a new scriptable object implementation, and one instance of that scriptable object. Is this a good approach?

  • @KonradGM
    @KonradGM Рік тому

    what is the color theme used for VSCode?

  • @cizlrb
    @cizlrb Рік тому

    So ScriptableObject.Destroy(); will destroy /delete the script from the project folder & not just in the hierarchy ?

  • @LeiaInc
    @LeiaInc Рік тому

    Great work, Samyam! Love your videos. Keep going! 🙌

    • @samyam
      @samyam  Рік тому

      Thank you!! 😁

  • @Thesupperals
    @Thesupperals 2 роки тому

    Watching this seemed very basic, and although a really good thing it also has me wondering about the limitations. These would extend to Dictionaries, lists, Indexing, using a NameSpace, and its just how far encapsulation can go.

  • @Jeff-zc6rr
    @Jeff-zc6rr 2 роки тому

    When you create an instance of a scriptableobject where is it? They obviously don't show up in the hierachy and they don't show up in any folder and they are not attached to any gameobject. So where was it? If you didn't create a scriptableobject with code you'd have to do it through the menu system and then it shows up in your folder so you can edit the values and then drop it onto a gameobject. But running CreateInstance does exactly what?

  • @ludo6314
    @ludo6314 2 роки тому

    THIS IS AMAING !! you and the way you explained it and also scriptable objects

    • @samyam
      @samyam  2 роки тому

      Glad to hear!

  • @0xF81
    @0xF81 Рік тому

    15:15 what about using this line instead of what you have on line 9 ? This way you'll omit implicit casting that might result in a runtime error, right?
    test = ScriptableObject.CreateInstance();

  • @ReneSteenNielsen
    @ReneSteenNielsen Рік тому

    Samyam what theme for VScode do you use?

  • @prosvade1337
    @prosvade1337 2 роки тому

    Hey would it be a good idea to use scriptable objects for projectiles in my top down shooter game? i'm trying to implement it but having trouble. Ive looked elsewhere and no one uses them as short lived objects. What do you think?

    • @NorthernlionLP
      @NorthernlionLP 2 роки тому

      I don't think you'd gain anything by putting meshes on scriptable objects. It won't save any memory since Unity already references duplicate meshes from a shared Mesh pool. Would 100% recommend object pooling though!
      I think ScriptableObjects mostly shine from a design perspective since you can use it to make quick adjustments to speed, damage, etc.
      Even if you want to describe every bullet in the scene, lets say with a 16 byte string that says "BulletAR", and a 4 byte int to store the damage. You'd only be saving 20 bytes per bullet in your scene. That's only 20KB saved per thousand bullets.

  • @astrahcat1212
    @astrahcat1212 2 роки тому

    What about just not inheriting from monobehaviour, having data be just classes you serialize into json or xml files, then load and save these data types.

  • @darkman237
    @darkman237 3 місяці тому

    So let's say you have an SO of item, with it's attributes and sub classes for armor, weapons, consumables, etc, each with its own attributes. How then do you access those things like: defense rating or attack rating? Or am I just not getting it?!?

  • @codeFriendlyART
    @codeFriendlyART 2 роки тому +1

    In between minutes 12~14, it seems that person is only thinking about the ones who makes or generates games / apps via Unity, instead of remembering that there are tools makers as well (like persons that extends on default Unity's Editor functionality) - so it is logical that SOs are also friendly for such usage as well. I don't get why the exaggerated [????] writing thing... Like if it necessarily needs to be a bug ?
    Then, about execution order, well, after all, it is just a generic file container, so I don't see why they need to forcefully be tied up to any particular execution order by design? Thus, when you do cast* them (their contents), it is not 'so you can access it more easily' but rather, so you can access it. Like, so it can become the adequate data/variable type for your script to correctly handle without producing an error.
    Regarding instantiating and memory usage, nothing takes RAM memory until you actually spare 'room' for it (allocate) at execution time. So (in my opinion) stating that because some data structure is residing in an SO will make it not to consume memory can be misleading for the new ones. It does consumes storage memory while at the file (SO) dormant level, the memory needed to store the related file content, plus, if you decide to instantiate many enemies say that makes use of any value store in there you are casting into your own variable and using, then it is using exactly the same memory as any other regular monobehaviour script structure will use. 500 individual enemy health float variables on game screen takes the very same RAM memory if instantiated (allocated) at run time, no matter if from a file's data (SO) or from a script. Allocating for usage is allocating for usage. So I think that the memory conservation can be a misleading subject all-in-all. Unless I'm not getting to understand the point, in case which I do honestly apologize for any related confusion then.

  • @ZactarZero
    @ZactarZero Рік тому

    Can you really make a save system system with them? It seems the changes are not persistent if you close and reopen the game in a build, outside of the editor

    • @jmikleo4336
      @jmikleo4336 Рік тому

      you can not make save system with them, they only retain value in the editor or any other scene which is reference that specific scriptable if they are no reference for it in the other scene the scriptable object will go back to its previous state.

  • @someoneontheinternet3090
    @someoneontheinternet3090 2 роки тому

    Your sponsor message scares me to death

  • @ShootYourBricks
    @ShootYourBricks 2 роки тому

    Why didn't anyone mention this when I was tackling the binary formatter to just save some simple data🤪 Is there a benefit to storing data that way instead of scriptable objects(like security)
    EDIT: I'm dumb XD I didn't realize Scriptable Objects didn't save in the game build

  • @burceaionut6516
    @burceaionut6516 Рік тому

    I've always wanted to make soft but every ti I download software to do so, I just look at the 5,000 buttons/settings, cry for a few

  • @tubyuwu2320
    @tubyuwu2320 2 роки тому

    Could u make a tutorial of how to get active controller? if is a playstation, xbox or a keyboard?

    • @samyam
      @samyam  2 роки тому +1

      The PlayerInput component has an event you can subscribe to OnControlsChanged that tells you when a new device is registered, I go over it here 26:40
      ua-cam.com/video/Y3WNwl1ObC8/v-deo.html
      But a dedicated video is a good idea :)

  • @flyswitdesigner9097
    @flyswitdesigner9097 2 роки тому

    Hello samya I love your content and your excellent voice I am going to leave my subscription and like, but I have a question, with the new input system you can interact with objects, that is, doors, cabinets, pick up stones or boxes etc, with mobile controls and with the keyboard??

    • @samyam
      @samyam  2 роки тому +1

      Yes of course! The input system just managed input, it’s up to you to read the input and do what you want with it. Thank you!!

    • @flyswitdesigner9097
      @flyswitdesigner9097 2 роки тому

      @@samyam awww thank you thank you but I'm new to that system jsjsjsjs 🥺🥺🥺🥺 you couldn't do a tutorial on how to do it please☺️🥺🥺

    • @samyam
      @samyam  2 роки тому +1

      ua-cam.com/video/m5WsmlEOFiA/v-deo.html

  • @jinbeisallblue9016
    @jinbeisallblue9016 2 роки тому

    I'm a simple guy..
    I see my name, i click

  • @bunnybreaker
    @bunnybreaker 2 роки тому

    I've been using ScriptableObjects for a while, but I had no idea about those built in functions and their shenanigans. I'ma stay the hell away from those jeez.
    Thanks for the video.

  • @yjonesy
    @yjonesy 2 роки тому

    Game idea: drink a shot every time you say "scriptable object"!
    Jokes apart, very exhaustive explanation. 👏👏

    • @samyam
      @samyam  2 роки тому

      Hahaha that would cause alcohol poisoning. Thanks so much!

  • @Esimaxchannel
    @Esimaxchannel Рік тому

    Don't you think there are many mistakes in this video, I would say is best to re-record it if it is possible and add the new link into this.

  • @nova_digital_video
    @nova_digital_video Рік тому

    life is life la laa - la la la bruh

  • @attenurmi936
    @attenurmi936 Рік тому +1

    Scriptable objects are NOT meant to be used as a save system! You will lose data if you try to use them in a program as a way to save persistent data.
    Here is a demonstration video from Code Monkey about this pitfall:
    ua-cam.com/video/5a-ztc5gcFw/v-deo.html

  • @user-gw6ht8og5j
    @user-gw6ht8og5j 2 роки тому

    I feel like there is gonna be a r/whoosh joke here

  • @mrxbg4610
    @mrxbg4610 Рік тому

    the way.

  • @wormholeinteractive
    @wormholeinteractive Рік тому

    It's like a variable on steroids!

  • @manuelabarcacrespo8298
    @manuelabarcacrespo8298 2 роки тому +1

    you can set values to enums, so the part of "Replacing enums with scriptable objects" makes no sense. Anyway, it was a great video and very educational, TY

  • @moviesixstudio8626
    @moviesixstudio8626 Рік тому

    god bless u xdd

  • @NotASpyReally
    @NotASpyReally 2 роки тому

    This is a good tutorial but the start looked like an ad and made me cringe a bit D:

  • @NorthernlionLP
    @NorthernlionLP 2 роки тому

    How the script was written for this video -
    ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects. ____ _____ _____ Scriptable objects.

    • @samyam
      @samyam  2 роки тому

      I don’t write scripts 😉

  • @reverbloadedmusic6190
    @reverbloadedmusic6190 Рік тому

    Dave 84

  • @Chieseled_Renegade
    @Chieseled_Renegade 2 роки тому

    UwU

  • @reallynigge
    @reallynigge 2 роки тому

    mac

  • @goldduck924
    @goldduck924 2 роки тому

    and sa tNice tutorialng other way around

  • @emanueltejadacoste2250
    @emanueltejadacoste2250 2 роки тому

    And how the heck do we learn machinations xD? Joking

  • @PeterSedesse
    @PeterSedesse 2 роки тому +1

    great video. Just to add a small opinion. Do away with the random b-roll stuff, it is just distracting and non-informative. Just keep up your graphics instead of flipping back and forth to random b-roll people.

    • @samyam
      @samyam  2 роки тому

      Thanks for the tip! I actually think the B-roll increases audience retention to keep capturing their attention, but I’ll play around with it and see the best results :)

  • @Jeff-zc6rr
    @Jeff-zc6rr 2 роки тому

    Where is the script that you created with code? After the "how to create a scriptable object" there is nothing of value actually. Those lifecycle methods are not useful. A more useful demo would have been to get data for 100 objects from a database, then create a scriptable object for each to apply to each enemy. You're essentially bringing the scriptable object into existence and destroying it before we even know it even existed.. how is that useful?

  • @eladonstar2721
    @eladonstar2721 2 роки тому

    Sam you got 18k subs...
    Why posting only one video per month then 😐😐😐

    • @samyam
      @samyam  2 роки тому +2

      Cause I’m a busy person! 😉

  • @MrDavehathaway
    @MrDavehathaway Рік тому

    The ENUM explanation is so wrong. Who in their right mind uses values in their code when they have ENUMS defined ???????? Sounds like a case of someone not knowing basic programming - NO magic numbers! It is a really good idea to use the Scriptable Objects instead though.

  • @Smir-jo4rj
    @Smir-jo4rj 2 місяці тому

    please do not use scriptable objects as a save system, its not persistent when you build the game, if you do use scriptable objects, use json

  • @monkeyrobotsinc.9875
    @monkeyrobotsinc.9875 6 місяців тому +1

    it would be cool if you pitched your voice down to a male level so it sounded super cool and not god awful annoying. so i have to leave and thumb you down so sorry.

  • @jwakeuplink7671
    @jwakeuplink7671 2 роки тому +2

    Good video, I didn't know about the OnEnable etc in ScriptableObjects!
    I'm confused about the use of ScriptableObjects to replace enums though. My understanding is that you should never hard code in the index, e.g.:
    if (attackChoice == 0)
    You should use the name of the member, e.g.:
    if (attackChoice == AttackType.SWEEP)
    So it shouldn't matter if an enum member is deleted. I thought enums are largely used to avoid this specific issue of having to hard code in numbers for a set of options.
    And in the situation where you're working with a messy codebase - where whoever wrote the code has been littering indexes as they relate to an enum, rather than the enum itself - and you need to delete something from an enum knowing full well that there are index magic numbers that will break elsewhere in the code, there seems to be a better fix.
    Rather than delete an enum option or replace it with NONE, you can just manually set the member after the deleted one back to its expected index, e.g.:
    enum AttackType {
    SWEEP,
    //removed JAB, which was index 1
    TEST = 2,
    SIDESTEP
    }
    Now you've removed the unwanted member without affecting any of the existing indexes.
    Finally, there shouldn't be a problem with a designer creating a new enum member, unless there are magic number index references (instead of referring to the enum member name).
    Please do let me know if I'm missing something here! Great video and I definitely learned something new, just lost on this one point. Subbed :)

    • @Eddycted
      @Eddycted 2 роки тому +1

      This addressed here in the talk samyam linked in the description: ua-cam.com/video/raQ3iHhE_Kk/v-deo.html
      Short answer: enums are serialized to their number values.

    • @christophwei2890
      @christophwei2890 Рік тому

      @@Eddycted Yeah but you can specify the numbers an enum value corresponds to

  • @ACADEMICMFC
    @ACADEMICMFC Рік тому

    realy work)