What are Scriptable Objects? (EXTREMELY Useful, Make your games Designer Friendly)

Поділитися
Вставка
  • Опубліковано 11 січ 2025

КОМЕНТАРІ • 187

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  4 роки тому +22

    Scriptable Objects! Have you used them? They have so many awesome possible uses!
    🌐 Have you found the videos Helpful and Valuable?
    ❤️ Support on Patreon www.patreon.com/unitycodemonkey or get the Game Bundle unitycodemonkey.com/gamebundle.php

    • @matrettr8037
      @matrettr8037 4 роки тому

      After this video i will use them at 100%. Nice video like

    • @waterfan3399
      @waterfan3399 4 роки тому

      Hey, I saw that you are online. Please make a series on C# for Unity in which you may tell about commands like addforce etc. Please make a playlist.

  • @GameDevExperiments
    @GameDevExperiments 4 роки тому +37

    You explained it very well. I made a tutorial series for a Turn-Based RPG like Pokemon, where I stored the data of pokemons and their moves using scriptable objects. Now, I can point people who are unfamiliar with it to this video, so they can understand the basics before following my series.

  • @huyopo
    @huyopo 4 роки тому +24

    Scriptable Objects can not only store data, they can also used for things like communication between entities.
    Its often a better alternative to use scriptable objects than to use Singletons (witch you shouldn't use that much, only in really rare circumstances, some say you shouldn't use them at all).
    Also, ScriptableObjects can contain logic.
    If you make them abstract, you can use derived scriptable objects to implement the logic of a gameobject.
    Its more flexible than using different MonoBehaviours and you can hot swap behaviours without destroying and replacing MonoBehaviours.

    • @lanefaulhaber1824
      @lanefaulhaber1824 Місяць тому

      How can you use them to communicate between different entities? Do you mean through writing to them and observing their change, kind of like an event? Or how is the best way to communicate using scriptable objects?

  • @harrison298
    @harrison298 3 роки тому +4

    This is the only tutorial I've seen that actually made a distinction between the Scriptable Object Definition, and the Scriptable Object asset files that are instances of it.
    Everyone just refers to all of the various files as "Scriptable Objects" which was really confusing to me at first.

  • @dmytrosavostianov3055
    @dmytrosavostianov3055 4 роки тому +5

    Duuuuuude, firstly you save me with your DOTS videos, now you do with this one!
    Muuuuch love for you!

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

    One of my many go to Code Monkey videos, you have a lovely repository now of great tips and tutorials that is super helpful. Your voice/manner is also very encouraging and reassuring with confidence and you get to the point quickly. I love how you give just enough info quickly so we can go "oh yeah that's how it worked, I remember now" to also adding more detail. You deserve great things my friend!

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

      Thanks for the kind words! I'm glad my videos have helped you!

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  4 роки тому +1

    🌍 Get Code Monkey on Steam!
    👍 Interactive Tutorials, Complete Games and More!
    ✅ store.steampowered.com/app/1294220/

  • @xkittencatx
    @xkittencatx 3 роки тому +5

    I loved how you explained it! It made it very easy to understand! I think I can use Scriptable Objects a little bit more intuitively now; when I first read about them they seemed SO complicated!

  • @KrazyKain
    @KrazyKain 4 роки тому +58

    I'm really going to have to rethink how my rpg engine handles characters and items after watching this :D

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

      Yes. This. I always find a new way to refactor everything and If I can manage the transition it always makes further extension easier.

    • @laodes
      @laodes 3 роки тому +1

      But I've never managed the transition successfully. Something always ceases to work and have to reimplement.

    • @mattjclay
      @mattjclay 3 роки тому +1

      I started using them for everything. It makes everything so much easier.

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

      Yup, sounds perfect for player statistics, quests, inventory, loottables and so on :D

  • @skye734
    @skye734 4 роки тому +10

    Man you're really doing great job!!!You are using your time and skills to make our journey easy.Huge Respect and love for you.🤗

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

    Still the best video on this topic to be found anywhere.

  • @arrain4737
    @arrain4737 4 роки тому +6

    I've never worked with scriptable objects. I would say let's expand our horizon! :)

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

    Definitely gonna give this a try some day. Thanks, very useful video, as always.

  • @pamalott5
    @pamalott5 4 роки тому +1

    Oh I waited so long for this!😊

  • @rickloyd8208
    @rickloyd8208 4 роки тому +1

    Really awesome video and good tip regarding SO are sent by reference. That will definitely save the memory. Cannot wait to see next part about custom editor. That makes scriptable objects ideal for custom Editor tool! Thanks for you job and sharing your experience with us!

    • @mrbananaman8032
      @mrbananaman8032 4 роки тому

      Yes but this actually a bad thing if you want to be able to enhance an item or ability only for one player or enemy, not all of them

  • @nanito0071
    @nanito0071 4 роки тому +1

    your videos are a huge help to my videogame, ill try to support in every way i can.
    Thank you!

  • @Gonzakoable
    @Gonzakoable 4 роки тому +1

    One quick thing, they can also be other stuff than just data. A scriptable object is pretty much the same as a monobehavior but without an update method

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Yup, I plan to explore using Scriptable Objects for handling logic in a future video

  • @arcday4281
    @arcday4281 4 роки тому

    Cool! As always. We are looking forward to the next video.

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

    Thanks this helped with some data issues I was having when changing scenes. I needed the data to persist through scene change, but I needed it to reset upon starting the game. Seemed like Scriptable Objects are the solution!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому +2

      That is one approach, just be careful you fully understand how persistence works with regards to scriptable objects. They will act persistent in the Editor but not in a Build
      unitycodemonkey.com/video.php?v=5a-ztc5gcFw
      unitycodemonkey.com/video.php?v=CjJNeyyhsKs

  • @CyberStudios
    @CyberStudios 3 роки тому

    Thank you for this! I have been binge-watching all your videos.

  • @rickloyd8208
    @rickloyd8208 4 роки тому +4

    I have a question, what makes scriptable object more attractive than public properties of the component? They are both editable... the only advantage I see is that scriptable objects could be places in some config folder and designer may not need to search to which object the controller component is assigned (I saved your video and liked in advance, I will watch it tomorrow, sorry if you answered this question within video)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +6

      The main point is they are stored as asset files in your project. They have the same type but different data. So a programmer can create the scriptable object definition for a weapon and make the game work with that definition and then a designer can very easily create more weapons by just creating more objects and setting their data.
      What you're describing would be doable with a Prefab and a script attached to it, but at that point you have exactly a scriptable object but in a more dirty way.
      In the next video I will cover a use case of adding SCriptable Objects to the Crafting System

    • @rickloyd8208
      @rickloyd8208 4 роки тому

      @@CodeMonkeyUnity Thank you so much for your awesome videos! I will watch this video and the next one =) So may be I will come back with some clarification questions later!

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

      @@CodeMonkeyUnityah this definitely makes a ton of sense

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

    the cleanest explanation and demo, thank you!

  • @sekker2k446
    @sekker2k446 4 роки тому +1

    I love your videos. Simple you are the best.

  • @TinyDeskEngineer
    @TinyDeskEngineer 3 роки тому +1

    70% of the projects I've started since learning how to use scriptable objects use scriptable objects for basically every single thing out of the still very small amount of things I did

  • @RodsOnly1
    @RodsOnly1 4 роки тому +1

    i can't wait for the steam app!!!!

  • @KM-zd6dq
    @KM-zd6dq 8 місяців тому

    Great video, if you use "will not/will" instead of "wont" it will make it even better

  • @algs5483
    @algs5483 4 роки тому

    Thanks. I really needed a good tutorial/ lesson. And you alwalys ( or almost alwalys) do so.

  • @Andrew90046zero
    @Andrew90046zero 4 роки тому +4

    I wish unity could redo the "asset creation context menu" so it would be more like the "add component menu" that you can search and it oly displays 1 tree layer at a time. That would make scriptable objects way much better.
    I use Odin Inspector, and I found this script that one of the devs of Odin released where It creates a "super list" of all of the scriptable objects regardless of it having a "CreateAssetMenu" attribute. So you can just search it up and create it, much smoother workflow.
    Also, I'm afraid to click the like button 😬 666 likes lol

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Yeah that menu does start to become massive as you add more packages, making it like the component menu would be great

    • @farfi55
      @farfi55 4 роки тому

      can you link please?

    • @Andrew90046zero
      @Andrew90046zero 4 роки тому

      @@farfi55 If you're talking about that scriptable object script thing. Yes.
      I actually had to dig for the original link for a minute. And it turns out there is a list of different custom scripts on their website. odininspector.com/community-tools/540/scriptableobject-creator
      odininspector.com/community-tools

  • @Eternal_Games1
    @Eternal_Games1 5 днів тому

    can I use the Scriptable objects to make a dialogue system?
    where you interact with npc have a dialogue, respond and get quests. and the next time you have different dialogues?

  • @FM_GOBi
    @FM_GOBi 4 роки тому +1

    I love your videos man!! How come you like saying "yup" so much?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      No idea, it just sounds good! I like constantly testing and verifying that the code works so I ended constantly running the game and going "yup the code runs!"

    • @FM_GOBi
      @FM_GOBi 4 роки тому

      @@CodeMonkeyUnity Thank you for the tutorials. I always watch them with my Evernote on the other monitor, so I can take notes. It's a huge help. Good luck with your work!

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

    Please make the video with a custom editor. Maybe you could also make a video with this scriptableobject custom editor to make levels. Like a 32x32 grid system where we can paint levels on the SObject and create the level by reading the data. Like making a texture2d based level editor but one which is dynamic

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Yup I covered Custom Editors here ua-cam.com/video/bMuTsAma4tk/v-deo.html
      And here ua-cam.com/video/rPBISPzmhog/v-deo.html
      I'll be using that in the next video to make a custom editor for the Crafting Recipes.
      Making a Scriptable Object to hold Level Data would be a great example project, I'll look into it, thanks!

  • @McFlyT28
    @McFlyT28 3 роки тому +1

    Watching this video, I can't help but think of well this would apply to RPGs

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      Yup, RPGs are full or data so this is extremely useful

  • @preflopstore9718
    @preflopstore9718 4 роки тому

    Fantastic Tutorial!

  • @santiagogonzalez7291
    @santiagogonzalez7291 4 роки тому +1

    What keyboard do you use? Or at least what color keys. The key sound is very good XD

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Not sure, I've had it for 10+ years, it's a Samsung something

  • @ZiplawDev
    @ZiplawDev 4 роки тому

    Can you make a video on Graph View? There's basically no videos online on the topic (or at least ones that explain the API step by step)
    It's the API that shadergraph uses, and it'd be really useful for dialogue systems for example

    • @r1pfake521
      @r1pfake521 4 роки тому

      Check this ua-cam.com/users/MertKirimgeriGameDevvideos there are some videos about Graph View they show everything you need to get started. Should be easy enough to create your own dialog editor after watching these videos.

  • @sundarakrishnann8242
    @sundarakrishnann8242 4 роки тому +1

    What is the library (using CodeMonkey.utils) which is seen in many videos? How did you create? Is there a video on it?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      There's no video but you can download the complete package with all the source code and inspect it all yourself

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

    one from of bests channels

  • @sundarakrishnann8242
    @sundarakrishnann8242 4 роки тому +1

    Hey! Is it possible to create stuff like rogue like generation using bolt? If yes, it would be cool if you could make a tutorial on it!

    • @sundarakrishnann8242
      @sundarakrishnann8242 4 роки тому

      @@bezoro-personal hi ! Thanks a lot for your reply...i was just learning about rogue like generation and hence I got a doubt if it could be implemented in bolt..since bolt became free I just had a thought of using it..anyway thanks for thr reply..

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

      Sure it's possible, if you go the simple route of just having a bunch of premade level sections and randomly placing them to build your level it can be quite easy.
      If you want to go more complex it becomes more difficult and the more complex you go the easier it becomes to do it through code.

    • @sundarakrishnann8242
      @sundarakrishnann8242 4 роки тому +1

      @@CodeMonkeyUnity thanks a lot sir! You have replied exactly what I had wanted to know😊( about which could be preferred)...Again thanks a lot!

  • @WelbyCoffeeSpill
    @WelbyCoffeeSpill 4 роки тому

    Also,..not sure I want like 80 item objects filling up my project directory. I usually do the excel csv thing. And store new instances of 'item' in a list. I don't understand the big advantages,...yet, to be honest. I guess editing is easier?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      If all you have is text then yes using a Excel spreadsheet would be better.
      But if you have a more complex data structure where you want to store text and images and videoclips and anything else then scriptable objects are very useful.
      In the next video I'll show a use case of applying this to the Crafting System

  • @mcbvideogames
    @mcbvideogames 4 роки тому

    Question! I am making a game which has a set of spells. I didn't know of ScriptableObjects beforehand, so what I did is: I created an abstract SpellBase class script (extending monoBehaviour). It contains common attributes between spells, such as name, description, cost, and cooldown, and an abstract void (UseSpell()). For every new spell script, it extends said SpellBase, adds new atts if necessary, and implements the UseSpell() void. Lastly, a SpellManager script, which makes a List out of all Spells, excluding SpellBase, and on certain key presses cycles thtough the list, and when pressing another key, will trigger the selected Spell's UseSpell() void. Is scriptableObject worth extending instead of monoBehaviour? If so, how can I retain this hierarchy without making a drastic change in code?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      You can just swap our MonoBehaviour for ScriptableObject and everything will work mostly the same, only difference is functions like Start() and Update() wont be called automatically.
      Having a Scriptable Object for each spell type and and making Scriptable Objects for each spell action is indeed a valid way to go

    • @mcbvideogames
      @mcbvideogames 4 роки тому

      @@CodeMonkeyUnity Hey, thanks for your reply! Unfortunately, I have run into a bit of a problem. Scriptable Objects can't reference scene assets, so my healing spell gets a nullPointerException when trying to interact with the healthbarManager script. Any ideas on what should I do?

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

    I don't like them that much because they feel like singletons. For instance, in the enemy weapon example you mentioned, if I were to modify the damage of the weapon of a single enemy (weapon curse debuff or something), every other enemy holding that weapon would also be affected.
    However, just like singletons, if you plan ahead and know in what ways your game might be extended, then you are good to go.

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

      My general rule is to only ever use Scriptable Objects for static data. So in that case I would store the weapon base damage in the SO, but for any modifiers I would store them in the enemy/weapon instance and would not modify the SO at all

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

      @@CodeMonkeyUnity Yeah, that's a nice way of putting it into words and a good example of planning ahead!
      In my current case, I searched for this video because I was thinking of using SO's to create string managers (one instance to save keys for ES3/PlayerPrefs, another to store tags, and so on). This way, I will be able to keep the codebase more modular, rather than using a MonoBehaviour singleton that can be referenced by any system at any time.

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

    When I use a scriptable object, and change a value (like "isHeld"), then it changes that for the prefab of it, and not for the instance. How do I fix that?

  • @HuGGmaN
    @HuGGmaN 4 роки тому

    Hi, here is a question of something i can't find.
    Is there anyway to drag and drop an image INGAME, recognizing the 3d object more closest to the drop site and changing the skin of the object for the imported image?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      When you release the mouse, fire a Raycast and if it hits something get that renderer and change the material.
      You need to break that problem down into simpler parts, first handle dragging and dropping, then identify whats under the mouse, and lastly change the material.

    • @r1pfake521
      @r1pfake521 4 роки тому +1

      Do you mean drag & drop the image ingame from for example a ingame menu or from the outside of the game for example from the PC desktop or folder?

    • @HuGGmaN
      @HuGGmaN 4 роки тому

      @@r1pfake521 Exactly

    • @HuGGmaN
      @HuGGmaN 4 роки тому

      @@CodeMonkeyUnity Thanks for the answer, i'll try that part, but idk how the program will recognize the image and import it :(

  • @hhgnehcom7672
    @hhgnehcom7672 3 роки тому

    Hi Im doing a Card game,and I store Magic card(just run the method of that card then it destroy) method by ScriptableObject, but Its ugly to write a if Or switch(just traverse all type of magic card) method in ScriptableObject ,Is any way to just hook different method in inspector like Enum

  • @lanefaulhaber1824
    @lanefaulhaber1824 Місяць тому

    What if I want to use a scriptable object to manage something like enemy stats. And one of the stats is health. Should I have the Monobehavior of that specific enemy change its health when taking damage from the player? Or should I create a unique instance of a scriptable object for every enemy and change the health in the scriptable object? Trying to understand the best use for scriptable objects, if they are mostly a reference for monobehavior, or if they are to be written to more often than not.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Місяць тому

      Personally I like to only use SOs as read-only data containers, so in my case I just don't store the current health on the SO, I only store the starting health or max health. The current health is stored in a normal MonoBehaviour
      But that's not a requirement, you can use them for read-write data, there is a famous talk all about that pattern ua-cam.com/video/raQ3iHhE_Kk/v-deo.html&pp=ygULcnlhbiBoaXBwbGU%3D
      But keep in mind this possible problem ua-cam.com/video/5a-ztc5gcFw/v-deo.html

  • @supertenchoo4271
    @supertenchoo4271 4 роки тому

    thank you so much new thing added to my back pack

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

    hi code monkey, can you do a tutorial on how to make abilities with scriptable objects that have unique functions?
    I've seen several videos on youtube but they way everything is set up, each new ability is a new KIND of scriptable object.
    if you were to have 100+ different skills, it takes up so much space in the editor, it's hard to organize them.
    because when a SO is made, you cannot go in to override the function, therefore each SO has to be it's separate entity. I've been stuck on this for quite some time now.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  7 місяців тому +1

      If you have custom logic then one option is indeed like that, make a new type of scriptable object that contains the logic for that new skill
      Alternatively you could have a that takes in a scriptable object, checks the type and does the specific logic for that object. But in that case you then have logic separate from the scriptable object
      Yet another option is to go with a much more modular system. Make a scriptable object type for each "effect". Like "projectile", "fire", "dealsDamage"; where each of those would have that logic, and then you construct your skills by composing those different scriptable objects in some array inside the main skill scriptable object.
      I covered a modular character controller that might help point you in that direction ua-cam.com/video/mJRc9kLxFSk/v-deo.html
      Or simply use Interfaces with default function implementations, that way you don't need to write tons of code for each SO, just implement the interface, which can make it simpler.
      But whatever option you choose you are always going to have some amount of complexity if you want hundreds of skills, there's really no special pattern that makes a system like that super simple, just more manageable

  • @WelbyCoffeeSpill
    @WelbyCoffeeSpill 4 роки тому

    So many questions! Lol. If it is a reference to the SO,..and three orcs get a sword item SO, but only one Orc uses the sword and decreases its "durability" stat , will that alter the other two sword's durability?

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

      Yes Scriptable Objects are meant for shared data, in your case you would either store the durability in a different way, like as a member variable in each Orc script, or instantiate a new Scriptable Object for each Orc.

    • @mrbananaman8032
      @mrbananaman8032 4 роки тому

      @@CodeMonkeyUnity this is exactly why I dont get the point of SOs. Why would I ever want to save every enemy's weapon to disk? Its like a weird niche way of saving your game data if something happens to be an object, yet you'll still have to save everything else in a typical fashion anyways.
      Another way to look at it is that a SO really wants something to be an object (a sword here), yet in this orc example, you have to remove critical aspects of it like durability from the item and put it somewhere else. This just makes my brain twist in half.

  • @user-vs7qg8vi2d
    @user-vs7qg8vi2d 4 роки тому +1

    What unity are you using? Unity hub? Or some other unity? And where do i have to go to find the script programming place that you are using right now? :D

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +3

      Unity Hub is simply the program to manage all your Unity versions and projects, I'm using 2019.4
      For the code I'm using Visual Studio Community

    • @user-vs7qg8vi2d
      @user-vs7qg8vi2d 4 роки тому

      @@CodeMonkeyUnity thank you!

  • @pistoleta
    @pistoleta 4 роки тому

    The only things that annoys me is how they keep the runtime changes when running on editor. Changes dissapear after restarting unity but sometimes is a hustle specially if youre using Unity Collab

  • @matrettr8037
    @matrettr8037 4 роки тому

    Can you please make some more advanced tutorial in bolt? Like for crafting system or inventory.

  • @davidcalderwood7041
    @davidcalderwood7041 3 роки тому

    Is it possible to nest scriptable objects? For example I am working on weapon rarity in my game. So would it make sense to have a scriptable object for each type of weapon rarity? Legendary vs Common weapons vs any other rarity. I want all weapons of the same rarity to have certain things in common, like the weapon card and color base. Should those be scriptable objects that I then drag onto each weapon scriptable object? Or what would be the best way to set that up?

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

      Yup you can make a scriptable object to define the rarity and a weapon scrpitable object that has a field for that rarity. That would be a good way to do it.

  •  4 роки тому +1

    Eu gosto dessa prática. Muitos pensam nela como uma forma de facilitar a configuração de objetos, mas como apontado em 7:45, isso é bem útil para ter um melhor uso de memória. Como sempre, um ótimo vídeo.

  • @anonymoussloth6687
    @anonymoussloth6687 4 роки тому

    Please correct me if I am wrong: so the benefit of scriptable objects is suppose I have and an enemy script that is attached to each enemy in my game. That script will have data like sprites, animations, etc which are the same for all enemies but because each script is attached to a gameobject, it will create duplicates of that data.
    However, with scriptable objects, I can create only one container for that data and use that to reference the data in each enemy script. That will in turn save memory. Correct?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Yes, although not everything stored in a MonoBehaviour will be duplicated, only value types ua-cam.com/video/KGFAnwkO0Pk/v-deo.html

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

    You can make video about ScriptableObject + Tile map , Please!

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

    In my opinion scriptable object is just Data based I don't even know why they called scriptable object
    But i discover recently the nested scriptable object and I'm curious what is the difference and how this new type I will be useful

  • @brockormond4131
    @brockormond4131 4 роки тому

    So a couple of questions...
    1) Does scriptable objects ONLY contain data? Meaning they can't run any method calls on their own...
    if so, 2). Can scriptable objects be useful in conjunction with ECS?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      They can have methods as well, I'll cover an example of that in the next video when I add them to the crafting system.
      Sure, they can be used in ECS, you just need to grab the reference somehow and then you can use them for whatever you want. Although keep in mind they are objects used by reference, not value structs.

  • @marushirudesu
    @marushirudesu 4 роки тому

    Should i use Scriptable Objects when it comes to individual ability of the enemies?
    or I use Inheritance instead

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Both approaches are valid depending on your particular case. do a quick prototype to test both methods.

    • @marushirudesu
      @marushirudesu 4 роки тому

      @@CodeMonkeyUnity woah ,thanks brother

  • @r1pfake521
    @r1pfake521 4 роки тому

    Can you make a video about the TreeView Editor with basic editing features (like undo/redo and drag&drop to move the nodes up/down). Or can someone post me a link to some other video which shows these features, because I couldn't find any. Im not even sure about the current TreeView situation because it looks like they will make a new TreeView with the new UIElements API, but im not sure if it is already out or not, because I asked in the Unity forum and they sent me github links which are either dead or private and I didn't get any other answer from them yet.

  • @Juan-lj4pi
    @Juan-lj4pi 4 роки тому

    By any chance are you going to make a IEnumerator tutorial? either way, thanks a lot, I've learn a lot from your videos :)

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

      I'm usually not a fan of Coroutines but it is a subject I should probably cover sometime

    • @hawns3212
      @hawns3212 4 роки тому +3

      @@CodeMonkeyUnity Why are you not a big fan of them? Is it a specific reason or just habit?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      @@hawns3212 Just because they force you to use a very specific pattern of returning IEnumerator, doing yield returns and using a GameObject, that's not something I use anywhere else in my codebase

  • @AsasinoManik
    @AsasinoManik 4 роки тому

    I am a designer myself, so I just clicked it.

    • @nosamyd9474
      @nosamyd9474 3 роки тому

      (laughing noises here) WHAT A GOOD COMEDIAN! 10 OUT OF 10!

  • @arcday4281
    @arcday4281 4 роки тому

    Hello everyone Tell me how to make it easier and more practical: data Exchange between scripts. For example: Get position(). Create a script containing all the others-inheritance - get-set...? Use interfaces for each necessary function ? Or are there other options ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      You could implement an interface, IHasPosition then implement GetPosition() => transform.position
      That's what I used in some scripts on Battle Royale Tycoon

    • @arcday4281
      @arcday4281 4 роки тому

      @@CodeMonkeyUnity Thanks a lot. I'm still surprised by your superpower to respond to all subscribers)) It probably takes so much time...

  • @anonymoussloth6687
    @anonymoussloth6687 4 роки тому

    I am using scriptable objects to create different types of guns and store some data about them. Also, I am using your concept from the interface video to make a IGun interface and have a shoot function in it. The only issue now is how do I make scriptable object have a function that is specific to that gun so that in the main game program, i just need to pass a IGun variable and call the shoot function?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      That depends on how you handle shooting. Is it spawning a bullet prefab? If so you can store it in the scriptable object.
      Or do you need to do some complex logic that is not just data? If so then you need to write that code somewhere, maybe do a switch on a WeaponType run that code.
      It all depends on if you can abstract your shooting logic so that it is fully data driven.

    • @anonymoussloth6687
      @anonymoussloth6687 4 роки тому

      @@CodeMonkeyUnity I use raycasts to do shooting and each gun has a different shoot method depending on different logic that is related to their data such as range, fire rate, is automatic, etc.
      Currently I have a unity event in my scriptable object to which I have linked each of the shoot functions of the gun but I was wondering if there is a better way to do this

  • @strooja9032
    @strooja9032 4 роки тому

    Thanks for this awesome video. I have one little question. If i use a scriptable object for an object(for example bottle of water) and i buy three of them in the game. I can't store the amount in the scriptable object ,right? Because then it will overwrite the asset. How would you save the amount of the item? Thanks again for you great videos and i am looking forward to everything on this channel.

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

      You would create an Item class that would hold a reference to the ItemScriptableObject as the type and a simple int amount.
      Stay tuned for tomorrows video where I will cover exactly that.

  • @nohypelarx
    @nohypelarx 4 роки тому

    CodeMonkey: Can I use scriptable objects to change your simple SpriteAnimator animations at runtime. If not how could I dynamically change de sprites that can be played by the SpriteAnimator? Let say i have idle and walk animations for a unit and play them with the simple Sprite Animator from your video but i want to change the sprites of each animation at runtime to show other unit skin

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Sure, that sprite animator is just an array of Sprites so you can store the array of sprites in the ScriptableObject and modify the sprite animator to read the array from the scriptableobject instead of its own field.

    • @nohypelarx
      @nohypelarx 4 роки тому

      ​@@CodeMonkeyUnity I would like to create something similar to what you do in Simple Turn Based RPG of changing the sprites and animations on runtime. Thanks for answering. I really like your tutorials

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

    what does onbeforeserialization/onafterserialization mean in scriptableobjects? i dont understand the whole concept of serialization

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

      Serialization is basically taking the scriptable object with all it's data and converting it into a format that is saved. For example JSON serialization converts it into a JSON string.
      Those functions run before or after that process happens
      You don't really need to use them unless you're making some really custom logic where you want to process some data in some special way before/after Unity does the default serialization

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

      @@CodeMonkeyUnity can you help me understand it a bit deeper. when does the serialization process happen? is it when we create a scriptableobject in our asset folder? or when its instantiated in the game ?
      Im using dictionaries and i need to have isrealizationcallbackreceiver to get an id for the SO
      Im using a SO for my inventory and SO for my inventory items so the id reference changes.
      it becomes a bit tricky to save scriptable objects within a scriptable objects

  • @p1no_839
    @p1no_839 4 роки тому

    Do you think it's a good idea for a beginner to copy code from stack overflow until you learn them?

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

      It's definitely a good idea to use stack overflow to help you solve your problems, but when you find the solution don't just blindly copy it. Instead take the time to understand why it works.

  • @aboukris
    @aboukris 4 роки тому

    Hi @CodeMonkey
    I tried to register on your site, the sending configuration email does not work please check

  • @lollol-zk8dh
    @lollol-zk8dh 4 роки тому

    Is this possible to be made in say like roblox? which uses LUA

  • @mr.jsingh2384
    @mr.jsingh2384 4 роки тому +1

    Are you not going to make bolt tutorials

  • @gower1973
    @gower1973 4 роки тому

    So it’s just like a struct or class with just member variables and no methods?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      The main point is that it's an asset stored in your project files.
      It can be used for data but it can also hold logic, you can add any type of functions you want. I'll cover that a bit in the next video when I add Scriptable Objects to the Crafting System.

    • @mrbananaman8032
      @mrbananaman8032 4 роки тому

      Yeah, I still don't understand the advantage over the added complexity. I don't understand what problem SO's fix besides being able to let non programmers mess with item stats in the UI or something.

  • @silverdragon711
    @silverdragon711 8 місяців тому

    @CodeMonkeyUnity - In your current tutorials you mention always making things private. Is that not true in a scriptable object?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  8 місяців тому

      Yup scriptable objects are the exception, the reason being because I only ever use them as read-only data containers, I never modify them.
      However scriptable objects do not enforce that rule, that's just a personal rule that I follow, if it's public you can write to it which might break all sorts of things.
      So if you don't trust yourself to manually follow that rule or if you work as part of a team and aren't sure if everyone is going to follow it, then you can indeed make them private and expose Get() functions like for normal fields.

  • @nosamyd9474
    @nosamyd9474 3 роки тому

    im pretty new to unity i mean by this is posted unity isnt even installed yet! gimme some uhhh idk?

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

    So they aren't really designed for setting up references between objects?

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

      Depends if the object exists in the scene or as a prefab, you can reference prefabs since those are not connected to any scene

  • @osmanpekaydn4070
    @osmanpekaydn4070 4 роки тому

    I don't understand differance between structs and scriptable objects

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      A Scriptable Object is an asset that stores data and lives in your project files.
      A Struct can store data in memory

  • @Igor-rd2fb
    @Igor-rd2fb 2 роки тому

    Greetings. How do I reset ScriptableObjects after each play?

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

      You should never modify them so they should never need to be reset.

  • @giangbuitam4868
    @giangbuitam4868 4 роки тому

    can i change the data of scriptable objects in run time ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Yup, but be careful of the issues I mentioned regarding Editor saving vs Standalone saving

    • @giangbuitam4868
      @giangbuitam4868 4 роки тому

      Code Monkey how can i change data of them ? I don’t know how to do that

    • @Alzimovich2
      @Alzimovich2 4 роки тому

      @@giangbuitam4868 Never used SO, but they are simply scripts with public fields... so I assume SOinstanceName.fieldName = newValue; should do the job.

  • @kingofgame2762
    @kingofgame2762 4 роки тому

    Please tutorial for unity particle system 2d and if the video 2 hours I will watch the video

  • @thehacknologist1692
    @thehacknologist1692 4 роки тому

    Can you make a game with bolt in unity.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Sure, Bolt is extremely powerful and you can build anything with it

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

    Well, kinda shocked to see the .ass extension at the thumbnail xD

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Oh yeah I guess in some cases the time overlay will obscure the text

    • @bilbostabbins1882
      @bilbostabbins1882 4 роки тому

      @@CodeMonkeyUnity mmmmm
      .ass
      ets, Liked and Subscribed!

  • @johnpatrickjuni945
    @johnpatrickjuni945 4 роки тому

    Pls help me I'm just a student and know very little (almost nothing) about programming can you help me where to start, I'm just starting so pls help.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Learn the Basics of Unity here ua-cam.com/video/E6A4WvsDeLE/v-deo.html
      And C# Basics here ua-cam.com/video/IFayQioG71A/v-deo.html

    • @johnpatrickjuni945
      @johnpatrickjuni945 4 роки тому

      @@CodeMonkeyUnity thanks

  • @nahulseyon54
    @nahulseyon54 4 роки тому +1

    3nd like 3rd view 3rd comment and 3rd party...😆😆😆
    Bro how to patch an app using lucky patcher? Plz tell me if any one knows.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      That's a pretty complex topic, you should probably let someone else like Steam or the AppStore handle versioning and updates.

  • @sudhanshlone8284
    @sudhanshlone8284 4 роки тому

    Is using scriptable objects more performant?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Really depends on the situation. For example if you have tons of duplicated memory in use and you replace that with Scriptable Object references then yes.
      But in general they are not necessarily more performant by default, it all depends on what you're doing and your implementation.

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

    Thanks!

  • @Naufal12948
    @Naufal12948 4 роки тому

    Why untity not in phone

  • @topievan190
    @topievan190 4 роки тому

    Indonesia here

  • @semithegamedeveloper6995
    @semithegamedeveloper6995 4 роки тому

    i want to become a proffesional indie developer. do you believe me?

  • @zed538
    @zed538 4 роки тому

    HI there folks

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

    Thanks

  • @myelinsheathxd
    @myelinsheathxd 4 роки тому

    another level of json file😉.......

  • @JoligonOne
    @JoligonOne 4 роки тому

    Please Dotween video

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

    I have seen a bunch of stuff about scriptable objects and... I don't fucking get it. Like why should I save that as an scriptable object instead of a prefab? You save memory and it's supposed to be easier to use? How? I don't get it.
    Let's say you want to have a bunch of items that just use a "weapon" class, so they have like name, damage and speed. That seems exactly the use case for a scriptable object. But I could just create a Monobehaviour for that and I would save an object with that script and some default data as a prefab. Why it is better to use a scriptable object there? You are just passing by the same amounts of references, you are either searching for a prefab of that script or the scriptable object. I don't see how you are using any duplicate data there.

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

      A prefab doesn't define a "type", it defines an "object". So while technically you can do that it's the same thing as how you can hammer a nail with a proper hammer or with your fist. Both will work but you should really use the proper tool for the job.

  • @eduardo-cat
    @eduardo-cat 4 роки тому

    1 view :0

  • @andylockhart257
    @andylockhart257 4 роки тому +1

    Debug.love()

  • @Pedro_Marangon
    @Pedro_Marangon 4 роки тому

    First!

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

    Thanks!