DrowsyFoxDev
DrowsyFoxDev
  • 4
  • 27 139
Scriptable Objects in 6 minutes! (Unity Tutorial)
Hit the ground running with Scriptable Objects!
Scriptable Objects are perfect as data containers or modules that can hot-swap into place for a dynamic experience. However, that's not the limit of their power!
Using Scriptable Objects, we can introduce some new Patterns into our codebase, like the Event pattern, or extend and improve an existing one like the singleton pattern.
In this video, we'll check out the basics of Scriptable Objects and use them as editable data containers.
📝 Play around with the tutorial's source code:
github.com/DrowsyFox/Scriptable-Objects-Crash-Course
🌐 LINKS:
- Odin Editor & Serializer:
assetstore.unity.com/packages/tools/utilities/odin-inspector-and-serializer-89041?aid=1101ljmbd
🎵Music in this video:
Music by GameChops - gamechops.com
=====================
Discord: drowsyfox.com/community
Twitter: drowsyfoxgames
Instagram: drowsyfoxgames
Facebook: drowsyfoxgames
✉️ Subscribe to our newsletter: DrowsyFox.com
🦊 DrowsyFox™ is an indie game studio consisting of a small team of people who are passionate about creating meaningful and thrilling experiences through casual gaming.
Subscribe to our channel for Dev Vlogs, Tutorials, and more!
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 us fund this channel & future projects!
#Unity3d #ScriptableObjects #gamedev
Переглядів: 6 059

Відео

BETTER Sound Effects! Unity Scriptable Objects Tutorial
Переглядів 9 тис.3 роки тому
Organize, vary, and control your sound effects better using Scriptable Objects! Learn how to create a scriptable object for your sound effect that provides tons of flexibility such as handling multiple sound effect clips, varying and controlling the volume and pitch, as well as give you the ability to adjust the playing order and preview the results right in the editor as you configure it! on t...
You are using Debug.Log wrong, do THIS
Переглядів 9 тис.3 роки тому
Stop flooding your code with Debug.Log! Please see comment section on how to fix the vulnerability In the .color extension method that exists in this video If given the choice, I'd log the console instead of open the debugger. I find it more convenient, but there are some drawbacks which include messy console from extensive use and the risk of logs making it to production code. To solve this, I...
Don’t risk losing your unity project, do this now! | Unity source control Tutorial
Переглядів 3,2 тис.3 роки тому
Don't risk losing your unity project, set up source control ASAP! Losing your data is awful, and if you don't have a backup of it, recovering it often means re-writing or re-doing a lot of things. Enter: *Git*. In this video, we'll set up a new unity project (you can use your existing one instead of course), and connect it to github using git desktop. this is probably the simplest way to get st...

КОМЕНТАРІ

  • @user-qm1ol1ky8y
    @user-qm1ol1ky8y 6 місяців тому

    Im kinda noob in unity.. so what's a difference between using namespace and not using one? basically the code itself permits that all objects to use that method as an extension isn't it? Why bother using namespace? Or is it a practice to control your project more wisely? not sure

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

    Interesting approach... very bad presentation! Your typing was way too fast, you move off of screens too quickly and your text was too small. - Again, a good topic, but a very bad presentation.

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

      Oof, “very bad presentation” - a bit harsh, but point taken 👍 thanks for the pointers!

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

      ​@@DrowsyFoxDev I thought that it was really helpful. Got it working, and added a GetType() reference in the output, so that you get both the class, and the specific object where the log is called from. One thing that I'd like to fix is that, currently, when clicking on the log message, it sends you to the Log method you made in this video. Ideally, it would send you to the place in the code where the method was called from. The information is there (You can scroll to where the call was made in the console, and double-click it), but when you double click the main log entry, it takes you to this Log method. I even disabled the method in the stack trace, so that the messages were uncluttered, but it would be nice to have that smooth, double-click, go to the place where the method was called, workflow. Any idea how to achieve this? Anyway, thanks for the video. Like I said, it was really helpful!

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

    I love how you make so many interesting points, but honestly, if I was a beginner watching this, I wouldn't understand at all what is going on. I would suggest not being afraid of making 15 to 20 minute videos laying everything out in a way that makes it more understandable for those who need it most - beginners.

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

    I use debug.logerror(). Thanks for the tutorial

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

    Thanks so much! you saved my project!

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

    this is sure more useful than my usual Debug.Log("kawabonga");

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

    This was super helpful, thank you so much!

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

    I love how you show the changes side-by-side. Very helpful! But one question I hope you can clarify. You mentioned you’d want to avoid creating many different instances of a prefab for all the customizations. But wouldn’t you just need to do this for the SO instead before attaching to the monobehavior? Aren’t you just shifting the responsibility? Thanks!

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

    Very clear. Thank you.

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

    Slow your speech down a good 10%. Also the only people watching this are noobs. Type out your code on screen. Explain it. This is a common mistake in tutorial videos, with people making videos about topics that are only going to be useful for someone of a certain skill level, but they do not explain the details required for someone of that skill level.

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

    Can someone please teach me how to disable it? I genuinely don’t want it on and I accidentally clicked the button..

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

    How do i know what license i use

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

    Thank you for sharing your work dude! You're awesome! I'm trying this, but in the first step adding this.Log(); fails to me

  • @jupiterlol2.045
    @jupiterlol2.045 2 роки тому

    Cuz I kept lagging :(

  • @jupiterlol2.045
    @jupiterlol2.045 2 роки тому

    Do it in, Android

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

    at 5:44 you misspelled SFX lol

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

      in the chapters

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

      😳I don’t think I wrote any chapters, but I see the one you are talking about 😶

  • @DevDreamz-k6m
    @DevDreamz-k6m 2 роки тому

    Can you change the color of the msg

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

    I love your video!

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

    Thanks for the great video :) How are you getting the method parameter names to show/display in VS when filling them out? (example, the message parameter or prefix parameter shows up in a box greyed out)

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

      Hey Chris! I’m actually using Rider as my IDE, not VS - it seems to be just a native feature to it. There is probably some sort of plug-in for VS that can do the same thing, but unfortunately I’m not familiar with VS at all 😞 If you do find it, please let me know what it’s called!

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

    How do you add emojis inside the ide? :) thanks for great video btw

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

      Hey! Unfortunately, the built in console does not seem to support emojis (bummer! I tried it actually before the video) I ended up using Unicode characters instead (like the basic smiley face and exclamation mark) I believe other console assets ditch the built in logging window in favor of their own implementation, and that’s how they can get emojis into their logs. I wish it was native to unity’s console though!

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

    Great video, glad I found your channel :)

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

    As @midnightst pointed out, the “color” method can be named better, especially since it’s a global extension method for String class. Naming it .HtmlColor should be enough. Check out our convo in the comment section for more details if you are curious! In addition, there is a vulnerability for html injections in the .color extension method if misused To fix it, replace the color text parameter with a Color class one, then use ColorUtility.ToHtmlStringRGBA in color= to get the hex value for the given color! Cheers!

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

      Once again, sorry for letting you guess, but that's not what I meant. What I meant is that you're putting a functionality that only makes sense in specific local context (colors the string only when you put that string into elements which support html color markup), globally into a string type, everywhere. Now all your strings, everywhere in the project, have this function, which has a very global, generic-sounding name, but which only makes sense in very few specific places, and for all other places, it gives what we could call "bad/broken output". That's the wrong usage of extension methods. Since you're extending the type itself, you should use it only for functionality that makes sense *for the type itself*, regardless of context, as opposed to only for a specific combination of the type+some specific place where it can be used. That's what I meant. It's wrong from the architectural/structural point of view.

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

      @@MidnightSt thanks for the explanation! I summed up our other convo and edited my pinned comment so it’s easier to find! Cheers!

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

    5:15 did you just... put a global extension function named "Color", on a string? As in... ALL strings in your project now have a function named .Color, which returns that string enclosed in html tags? ...do you understand why I'm asking about it? Do you understand why that's an extremely dumb and bad thing to do?

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

      Ayo! Can you elaborate on why exactly it’s bad? It’s convenient and provides a way to color both TMP strings as well as console strings Would love to know the downsides!

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

      And for future purposes, would have been nice if you just explained why it’s wrong instead of hinting at it and expecting the other side to know “why that’s an extremely dumb and bad thing to do”, not very nice wording

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

      You are correct, the method is vulnerable to html injections as is. So thank you for pointing it out (though it felt condescending & in the form of a riddle, I would have appreciated you simply pointing it out!) To improve this extension & fix the vulnerability, we could take a Color argument instead of a raw string and convert it to html hex color using ColorUtility.ToHtmlStringRGBA I’ll try to be more careful in the future - but mistakes do happen 🙂 Cheers!

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

      @@DrowsyFoxDev "You are correct, the method is vulnerable to html injections as is." no, that's not what I meant. First, sorry for how I wrote the comment. At that moment, it was kinda condescending, I was in a bad mood, I apologise for that. What I meant is that you're putting a functionality that only makes sense in specific local context (colors the string only when you put that string into elements which support html color markup), globally into a string type, everywhere. Now all your strings, everywhere in the project, have this function, which has a very global, generic-sounding name, but which only makes sense in very few specific places, and for all other places, it gives what we could call "bad/broken output". That's the wrong usage of extension methods. Since you're extending the type itself, you should use it only for functionality that makes sense *for the type itself*, regardless of context, as opposed to only for a specific combination of the type+some specific place where it can be used. That's what I meant. It's wrong from the architectural/structural point of view. Again, I apologise for how I commented, and how I let you guess what I meant, I was in a bad mood. However, I appreciate that you took the time to think about it this much.

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

      @@DrowsyFoxDev anyways, you just got a subscriber, large part by how you handled my ...suboptimally... written comment. :)

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

    Useful, thank you !

  • @Kam-_
    @Kam-_ 2 роки тому

    What is it I accidentally clicked it pls help

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

    I am always a bit lost when it comes to the privacy bit. Who can see and change the project now? I assume when set to private, no one can see my files or change them. When not ticked the private box, only I can edit files, but others can download the project?

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

      Ayo! Private would mean only you, and anyone you give explicit permission to in project settings, can access the project and its source files Public would mean anyone can access it or look it up - they can submit a PR, fork the project, clone it, etc which I believe you can control more in depth in project settings Hope it helps clear it up a little bit!

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

      ​@@DrowsyFoxDev This helps a lot already, thank you!

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

    finally, a tutorial that doesn't make me sleep.

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

    tq

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

    Underrated Channel Count me as signed up

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

    Finally a hi-level and reliable coding channel for Unity. Well done man. Suscribed.

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

    May I ask how you are able to automatically apply the values when you change the scriptable object that it currently has?

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

      There is an Odin attribute being used called “OnValueChanged” that monitors the value bellow it and triggers the function given to it once it does There is a link to Odin in the description, it is a paid plugin - but you can often find it on a sale! You can check out the source of this project to see what other attributes I’m using, though the rest are just for cosmetic reasons I believe Cheers!

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

      @@DrowsyFoxDev got it. thanks!!

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

    Awesome tutorial!! hope you make part 2

  • @322ss
    @322ss 2 роки тому

    Thanks. Not much new information for me, but nice video editing!

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

    trying to do inventory just learn what the f this scriptable object :D

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

      Scriptable objects can be super useful for inventory systems! I might make a tutorial about it soon 😉

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

    Excellent video drowsy!

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

    This is the most underrated Unity channel I have seen so far. Absolutely love the professional digestible code you've provided. Excellent work!!

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

      You are too kind 🙏 thank you and hope you enjoy the videos to come! 🦊

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

    Nice tuto. How could I use that on specific material? I mean like my character walk on different kind of ground and the sound change if they walk on wood plank or metal sheets.

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

      To keep it short, I’d make a scriptable object per each kind of ground like steps_wood steps_metal and then attach these to the respective ground - then when a player steps over it and is in active moment, play the sound on loop and stop the sound when the player isn’t on that ground, or not actively moving Good luck! 🙌🦊

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

      @@DrowsyFoxDev I'm a bit new to that, but I'll try to figure it out.

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

      @@FyresGames feel free to join the discord and ask for help! I’ll do my best to help out, link in the description 🙌 I might make a tutorial in the future if time permits/there Is demand 😛

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

    Awesome idea and execution! Would you mind uploading this as an Asset to the Assetstore yourself?

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

      For now you can use the gist I linked in the description to start using this tool, in the future I’d love to release these as packages but that requires a lot of time effort & research I’m kinda tight on at the moment 😅😅

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

    Very cool, I never thought of extending the debug functionality this way, cheers friend!

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

    Very nice video ! Glad to see Odin being used !