Upgrade System in Unity - Stats Part 2

Поділитися
Вставка
  • Опубліковано 3 лип 2024
  • ✅ Save $100 on Nova UI for Unity: assetstore.unity.com/packages...
    👉Create an upgrade system with the Unity game engine and scriptable objects that is scalable and easy to use. The system is flexible and can be adapted to almost any genre of indie game.
    ✅ Nova UI (Paid): assetstore.unity.com/packages...
    ✅ Nova UI (Free): assetstore.unity.com/packages...
    Video Links
    ************
    📚 Code on GitHub: github.com/onewheelstudio/Adv...
    📽 Stats Video: • Stats in Unity - How I...
    📝Blog Post: onewheelstudio.com/blog/2022/...
    ✅ Odin Inspector: assetstore.unity.com/packages...
    📽 Code Monkey SO Video: • Be CAREFUL with Script...
    Support the Channel!
    **********************
    ► Buy me a coffee: www.buymeacoffee.com/onewheel...
    ► Shop the Unity Asset Store (affiliate): assetstore.unity.com/top-asse...
    ► Become A Channel Member: / @onewheelstudio
    ► Or a Patron: / onewheelstudio
    ► My video and streaming kit: kit.co/onewheelstudio/tutoria...
    ► Buy a Game Design Book: kit.co/onewheelstudio/game-de...
    Video Gear List (Amazon Affiliate)
    ***********************************
    ► Sony A6100 Camera: amzn.to/32logXz
    ► Sigma 16mm 1.4 Camera Lens: amzn.to/3KA4Wr4
    ► GoXLR (audio interface): amzn.to/35dmr03
    ► Shure SM7B Mic: amzn.to/3fNbV1E
    ► Blue Mic Arm: amzn.to/3tHgwdQ
    Neewer Light: amzn.to/3rD8eRv
    Light Softbox: amzn.to/3GUaHgQ
    Neewer RGB Light: amzn.to/3rCTQJ9
    Other Links
    ************
    Discord: discord.onewheelstudio.com
    Twitter: / onewheelstudio
    Devlog: onewheelstudio.com/
    Twitch: / onewheelstudio
    Timestamps
    *************
    0:00 Who doesn't love an upgrade?
    0:33 Sponsored Message
    1:45 Upgrades as Scriptable Objects
    2:08 Upgrade Base Class
    2:43 Stats Upgrade Class
    3:30 Modifying Stats
    5:26 Loose Ends
    5:37 Problem 1: Cleaning up SOs
    7:22 Problem 2: Instance Stats
    8:12 Odin??
    8:24 THE END :)
    #GameDevelopment #Unity3D #indiedeveloper

КОМЕНТАРІ • 16

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

    ✅Nova UI (Paid): assetstore.unity.com/packages/tools/gui/nova-226304?aid=1100lHSw
    ✅Nova UI (Free): assetstore.unity.com/packages/tools/gui/nova-free-trial-231156?aid=1100lHSw
    📝Blog Post: onewheelstudio.com/blog/2022/12/13/upgrade-system-stats-part-2
    ✅Odin Inspector: assetstore.unity.com/packages/tools/utilities/odin-inspector-and-serializer-89041?aid=1100lHSw
    📽Stats Video: ua-cam.com/video/B2JsymHzgvE/v-deo.html
    📽Code Monkey SO Video: ua-cam.com/video/5a-ztc5gcFw/v-deo.html

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

    Always wondered your way with using editor tools! Great video as always

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

    Nice work :D yet another great video.

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

    Fantastic video! Was looking forward to this. I also find it funny you also came to the same conclusion of using events to notify of upgrades for classes that may care about it, like I did.

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

      I love events. Maybe too much. 😊 I really like them in this case and in general as they can let you add functionality without messy coupling. Glad you liked the video! 🙏

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

    Awesome video!

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

    very good video from ows again

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

    Idea for the saving problem with scriptableobjects: just create a base scriptableObject called ResetSO that at OnEnable clones itself into an instance. Then use the instance to make changes. This way you always adjust changes to a clone and treat the scriptable object to start with as a preset

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

    damage ++; also a good upgrade system

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

      Especially if it is called in the Update() method 😉

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

    Great video as always. I would like to point out a (possibly) unintended side-effect. At 4:58, the code for applying upgrades is iterating through the list; this means the order of upgrades matter. If you start with 10 base damage, then get a +5 damage upgrade, followed by +100% damage upgrade, you'll end up with 30 damage. However, if you received the +100% damage upgrade before the +5 damage upgrade, it will be 25 damage. How would you handle this? Perform two foreach loops, first accumulating the non-percent upgrades, and then in the second foreach loop, compute the multiplier?
    Also, the dictionary is limited to one type, float in this case. Would storing ints, such as Level or CoinsCount, cause any issues?

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

      My intent was to have the order of upgrades matter. If you are going to mix things like +5 damage and +10% damage I think something like this is inevitable. I think the solution might be to simply not mix and match types. So if you have +5 damage you don't also have +10% damage.
      As for the dictionary, yes the value is limited to one type. You could make it a more general type like an object, but that seems a bit silly in this case. I wouldn't expect an issue with storing ints in a dictionary of floats. I would assume that the ints get converted to floats, but if you really need to ensure that particular values are ints you could always round them to ints when you need to use the value.

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

      I would just sort the list every time an upgrade is added. Multiplications at the end, so the player always has the most gain, no matter when he buys which upgrade. Feels most fair to me.

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

    would love to see more use case of odin inspector ...
    I've bought it for years but ...i only know how to use the simple stuff....and simple stuff aren't worth the effort to instlal the package....

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

    If I understood it correctly it seems like you are modified ScriptableObjects at runtime, which I'm personally not a fan of as I see them as static and non dynamic data containers which shouldnt be changed often at runtime.
    But other than that the system is pretty great and you can of course rebuild it with having the ScriptableObjects as non-changeable in mind.

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

      Plenty of folks out there using scriptable objects for runtime use cases. There are two famous Scriptable Object talks that cover it on Unity channel and there are a few frameworks for implementing some of those ideas like Unity Atoms.