Unity Playables is Actually a Game-Changer

Sdílet
Vložit
  • čas přidán 21. 07. 2024
  • The Playables API holds hidden potential that can transform your game development. In this video, you'll learn how to add runtime animations to your characters that come from objects that provide their own animations, automating complex sequences and creating more dynamic environments with minimal coding. Join us to unlock the secrets of these powerful tools and elevate your game's animation system to the next level!
    Links: docs.unity3d.com/6000.0/Docum...
    docs.unity3d.com/6000.0/Docum...
    Want to support me? 😀
    Buy me a coffee! ko-fi.com/adammyhre
    🔔 Subscribe for more Unity Tutorials / @git-amend
    Discord: / discord
    #unity3d #gamedev #indiedev
    ▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
    0:00 Playables API
    1:05 Playable Graph Setup
    5:00 Locomotion Mixer
    6:26 Dynamic Animations
    12:25 Doing More
    Source code: gist.github.com/adammyhre/f06...
    More Useful Code:
    github.com/adammyhre?tab=repo...
    Unity Utility Library: github.com/adammyhre/Unity-Utils
    Lock Inspector Hotkey: gist.github.com/adammyhre/475...
    Assets Shown In This Video (Affiliate Links)
    More Effective Coroutines: assetstore.unity.com/packages...
    Modular 3D Text: assetstore.unity.com/packages...
    RamsterZ Loot Anims: assetstore.unity.com/packages...
    Kawaii Animations: assetstore.unity.com/packages...
    Clazy Runner Action Animations: assetstore.unity.com/packages...
    Synty Prototype: assetstore.unity.com/packages...
    Hierarchy Icons: assetstore.unity.com/packages...
    Better Transform: assetstore.unity.com/packages...
    Better Mesh Filter: assetstore.unity.com/packages...
    Kyeoms VFX: assetstore.unity.com/publishe...
    Follow me!
    linktr.ee/gitamend
  • Hry

Komentáře • 130

  • @git-amend
    @git-amend  Před 14 dny +27

    Happy Sunday! Hope you all like this dive into the Unity Playables API, let me know in the comments if we should do a deeper dive into a more complex use case!

    • @Krechevskoy
      @Krechevskoy Před 14 dny +4

      I would love to see a deep dive on this. In particular it would be cool to see how to use this to use for something like a multi part interaction, like climbing a ladder (i.e. Dark souls), or a multi-actor interaction, like a finishing move (i.e. God of War) or a backstab.

    • @yonatanabergel
      @yonatanabergel Před 14 dny

      Would love! Unity 6 is very promising so far :)

    • @git-amend
      @git-amend  Před 14 dny +2

      All good ideas, I'm taking notes!

    • @ggwp8618
      @ggwp8618 Před 14 dny

      Hi. How about covering the topics of Photon Multiplyers?

    • @git-amend
      @git-amend  Před 14 dny +1

      @@ggwp8618 I've thought about that, but I'm not sure how well that would go over. But, I have been looking at the new Photon products lately, so it is in the back of my mind.

  • @SunSailor
    @SunSailor Před 14 dny +29

    Please continue on this topic, as Timeline is nothing else than a playable graph as well. It is an essential system for Unity and frustrating few coders know about it, not speaking about being proficient in it. We had to cut an awful lot of detail features, because people in my team even didn't understand what I tried to tell them about this system, so your videos would be essential resources, not only for me, but for the whole development scene. Thank you for the already made videos!

    • @git-amend
      @git-amend  Před 14 dny +7

      Sounds good, taking notes for a follow up. I’d like to talk about Timeline a bit more as well. Cheers!

  • @Fitz0fury
    @Fitz0fury Před 14 dny +14

    I had never even heard of this. another great video!

    • @git-amend
      @git-amend  Před 14 dny

      Haha, I thought you might like this one! Cheers!

  • @ImmortalTimothyM
    @ImmortalTimothyM Před 14 dny +10

    Wow, 1 minute into the video and just showing that More Effective Coroutines exists is worth watching this. Thanks.
    I have been looking into using the Playables system for interacting and emotes for a game so this is great timing.

  • @Assassin1923
    @Assassin1923 Před 14 dny +10

    Hi! Your channel is a real find! I am a unity developer and I find your content very useful. Thank you!

    • @git-amend
      @git-amend  Před 14 dny +1

      Happy to hear that! Thank you!!

  • @MrOmega-cz9yo
    @MrOmega-cz9yo Před 12 dny +3

    Hi! I was unaware of both Playables, and the More Effective Coroutines asset. Thanks for the info!

  • @adek445
    @adek445 Před 14 dny +2

    It's so cool! I would love to get into more complicated system that you've mentioned. I wish you will come up with some nice video that moves this to the next level one day.
    Much love!

    • @git-amend
      @git-amend  Před 14 dny +1

      Thank you... I think there likely will be a follow up vid to this with something more complex, look for that in a few weeks!

  • @GameDragon2k
    @GameDragon2k Před 14 dny +3

    This video came at a great time. As I was just exploring the Playables API.

  • @darkenaxe
    @darkenaxe Před 14 dny +1

    I didn't know about this API, thank you for this quick and efficient presentation!

  • @alif-fgd
    @alif-fgd Před 13 dny +3

    Great content as always! I had never heard of this API, looks powerful.
    Just some personal feedback in this particular video, with just your introduction I struggled to find the main objetive of the system or what pain a system like that could alleviate. I needed to see the end of the video to understand better what exactly you were trying to achieve. Might be just me, but anyway, I thought it could be usefull to share

    • @git-amend
      @git-amend  Před 13 dny +1

      Thanks for the comment, I'll keep your feedback in mind.

  • @derbabonennt8876
    @derbabonennt8876 Před 14 dny +3

    Although i knew the playable api this video was very informing.
    Could you make a video about the script-playables - these are the type of playables where I dont know how or for what to use them.

    • @git-amend
      @git-amend  Před 14 dny +1

      Yeah, I think we’ll have to have a follow up video to this one with a more advanced use case.

  • @friedcrumpets
    @friedcrumpets Před 4 dny

    I looked into this a few months ago and found barely any resources on it. It would be absolutely incredible if you could cover this in-depth. Such an incredible tool that doesn't get enough attention.

    • @git-amend
      @git-amend  Před 4 dny +1

      So far just one follow up vid, hasn't gotten much attention though. Perhaps down the road we can build something more involved though. It's definitely very useful.

    • @friedcrumpets
      @friedcrumpets Před 4 dny

      @@git-amend I'll drop it a watch and I'll keep my eyes for some more Playables content in the future. Keep up the great work 👍
      I noticed you were using IEnumerators in this too. Have you had a look at Awaitables yet? Or UniTask for pre Unity 2023. I've hopped off coroutines since I discovered these.

  • @Sosa829
    @Sosa829 Před 8 dny

    That's so cool, I seriously need a video explaining how to expand this into a full animation system with way more Animations/blend trees and Masks. how to add events at certain frames etc

    • @git-amend
      @git-amend  Před 8 dny

      Another great idea for a video, cheers!

  • @RafaelAzriaiev-kv9qm
    @RafaelAzriaiev-kv9qm Před 14 dny +1

    Very informative video.
    Small question would you use playable like delivering clip when changing equipment to use the animation of that specific weapon or would you use something else?

    • @git-amend
      @git-amend  Před 14 dny

      You certainly could do that, and in fact that might be optimal.

  • @Shonnyy
    @Shonnyy Před 14 dny +2

    Awesome vid! What's the drawing tool you're using to draw the playable graph diagram?

    • @git-amend
      @git-amend  Před 14 dny +3

      Thank you! The tool is called Excalidraw, you can use it online or integrate it with Obsidian: czcams.com/video/o0exK-xFP3k/video.html

  • @littleowlgaming-unity-tutorial

    just out of curiosity, you get the better courotines and all, because it allows to run a coroutine in classes that normally can't. what about async functions? that's what I use in like say scriptable objs that cant use coroutines. and you can run a async just like a coroutine and have return types

    • @git-amend
      @git-amend  Před 14 dny

      Another viewer made a similar comment. I've added a coroutines vs async/await discussion video to my TODO list.

  • @soheil4471
    @soheil4471 Před 12 dny

    This was a great video
    you've got yourself a new subscriber :)

  • @ChristopherYabsley
    @ChristopherYabsley Před 8 dny

    This is such professional content. Amazing work and thanks for sharing the knowledge.

  • @AryanSingh-cw6ce
    @AryanSingh-cw6ce Před 14 dny +1

    Very helpful video , I always learn something new by these ,If its not too much to ask can you tell me how to create a modular quest system , which can have conditions like how to start , connected with overall world variables (like if a very important event happened in game) than quest become unavailable or can no longer be continued, how to handle saving all the quest points of different types of quest, branching in quests.
    Also on side note: how does elden ring handle their quest allocation.

    • @git-amend
      @git-amend  Před 14 dny +2

      Thanks for the comment. That's an interesting topic for a video, I'll write that down! I'm not totally sure about Elden Ring (I haven't played it yet - shocking I know - but I'll find out).

  • @NongBenz
    @NongBenz Před 13 dny +1

    Surprised I haven't heard about the Playables API. Sounds like the smart objects in FEAR where the animations and data are stored in the world objects instead of on the player directly.

    • @git-amend
      @git-amend  Před 13 dny

      Hm yeah, they must have done something similar!

  • @RoxGame
    @RoxGame Před 14 dny +1

    I've always found the Playables API confusing, but your explanations make everything clear. Thank you! I'm wondering: what's the best approach to sync this system over a network?

    • @git-amend
      @git-amend  Před 14 dny +1

      Thanks for the comment... as for syncing over a network, that's a big discussion, but I would do my utmost to only sync the events happening and not the result of those events. And it really also depends on what package you are using - for the most part, Unity can handle syncing things that are done via the Animator, which is the case here (note that we passed the animator in when creating the PlayableGraph - the Animator is doing the animating and can be synced with a NetworkAnimator component for example if you were using Unity's NGO).

    • @RoxGame
      @RoxGame Před 14 dny

      ​@@git-amend I believe Mirror and NGO only sync animator parameters, which i believe not available in the Playables system. However, I'll give them a try. Thank you so much!

  • @PsychoNMG
    @PsychoNMG Před 14 dny +3

    Very cool video! I didn't even know "playables" existed. Certainly something I will be looking into.
    As a "code review", I'm curious if there was a reason you didn't choose to create an enum or a well named constant for the mixer inputs. Is it just because there are only 2 at the time of this video? Probably a bit of a fanatic's /zealot's mindset but I'm triggered when I see magic numbers / strings.

    • @git-amend
      @git-amend  Před 14 dny +2

      Thank you! And you are 100% correct, I am also not a fan of the magic numbers and should have changed them - and certainly I would have as soon as the system adds any additional complexity.

    • @midniteoilsoftware
      @midniteoilsoftware Před 14 dny

      You beat me to it ;)

  • @Broudy001
    @Broudy001 Před 14 dny +1

    Hot Damn that is wicked, I definitely need more of this.

    • @git-amend
      @git-amend  Před 14 dny

      Great, glad to hear that. I think I'll do one or two more on this topic in a little while.

    • @Broudy001
      @Broudy001 Před 12 dny

      @@git-amend I love to see / use this to do a combat system where the animations swap in and out based on the weaponry equipped or the position in a combo

    • @git-amend
      @git-amend  Před 9 dny

      That's a good idea, I'll jot that down

  • @yonatanabergel
    @yonatanabergel Před 14 dny +1

    This + Interactable system.
    Insane :)

  • @filipadamczuk99
    @filipadamczuk99 Před 14 dny +2

    Great video! I would love to see an episode about async vs coroutines in Unity. With the addition of the Awaitable class in the latest Unity versions, it seems that using coroutines is becoming obsolete. Focusing entirely on the async workflow appears to be more efficient. The ability to easily switch between threads with Awaitable is particularly impressive:
    ```csharp
    // Execute something on the main thread
    await Awaitable.BackgroundThreadAsync();
    // Now execute something on the background thread
    await Awaitable.MainThreadAsync();
    // And back to the main thread
    ```
    I think this approach is fantastic!

    • @git-amend
      @git-amend  Před 14 dny +1

      Great idea, I’ll add that to the list!

  • @Rigdereine
    @Rigdereine Před 14 dny

    I never new about Playables and now it will be my main research target.
    Do you prefer Coroutines over Async? I always prefer the UniTask Library and use them instead of couroutines but its actually just a personal preference and I would like to see a video about when to use what.

    • @git-amend
      @git-amend  Před 14 dny

      Sounds good - the Unity docs are a great place to start, and the dig into the forums a bit for more in-depth discussions. I'll probably have another video on this topic as well. As for coroutines vs async, several other commenters today have brought that up so I'll schedule a video for that topic coming soon!

  • @castlecodersltd
    @castlecodersltd Před 11 dny

    Interesting, thanks for sharing 🙂

  • @MrTomateSalat
    @MrTomateSalat Před 14 dny +4

    I only can recommend Playables to everyone because the Unity animator is really a terrible thing to deal with. The good thing is that it doesn't have to be an either or. In my last project I've created PlayableGraphs on the fly and let them take control over the animator. So for basic locomotion stuff I use Animator (as long as it isn't complex animator is good enough) but for more advanced stuff I go for Playables.

    • @git-amend
      @git-amend  Před 14 dny +1

      I like this approach. I would opt for this as well, a combination of both is really the best way to go in most cases.

  • @garryguan7115
    @garryguan7115 Před 14 dny +1

    What setting in Rider are you using for AI code gen?

    • @git-amend
      @git-amend  Před 14 dny

      I don't think there is any AI Code suggestions used in this video, but in other videos I typically use GitHub Copilot, though I have the JetBrains AI as well which is better suited for other tasks such as refactoring. (in my opinion)

  • @tommelling9847
    @tommelling9847 Před 14 dny +2

    Amazing stuff! Didn't even know this existed, would have been incredibly useful on out last project.
    Also the way you deliver higher level concepts is amazing, talking through each part without making assumptions and 'skipping' ahead. You have a rare talent for teaching. Keep up the good work.

    • @git-amend
      @git-amend  Před 14 dny

      Glad to hear that! Thank you!

  • @FudgelGames
    @FudgelGames Před 12 dny

    Terrific as usual! Your videos always seem to pop up at exactly the right time for me. The only part that left me a little confused is the blend duration calculation. Wouldn't Mathf.Min(clip.Length * 0.1f, clip.Length / 2) always return clip.Length * 0.1f since 10% will always be less than 50%?
    Would it possibly make more sense to calculate the duration as follows?
    Mathf.Clamp(clip.Length * 0.1f, 0.1f, clip.Length * 0.5f)?
    Or am I just really confused 😅?
    /edit - I guess I really am confused! Clamping doesn't make sense here since again, 10% of clip length will never be greater than 50% of clip length 🤦‍♂

    • @git-amend
      @git-amend  Před 12 dny +1

      Thanks for your kind words! You’re right about the logic. Mathf.Min(clip.length * 0.1f, clip.length / 2) will indeed always return clip.length * 0.1f because 10% is always less than 50%. Using Mathf.Clamp(clip.length * 0.1f, 0.1f, clip.length * 0.5f) is a better approach as it ensures the blend duration is not less than 0.1f and not more than half the clip length. Great catch!

  • @raymk
    @raymk Před 8 dny

    I've been wanting to make a custom Playable script for custom Timeline tracks, but it's pretty hard to understand.
    I hope one day you will touch on that!

    • @git-amend
      @git-amend  Před 8 dny +1

      Next Sunday's video will be about slightly more complex Playables, and while not specific to Timeline it will explain a few of the more complicated things you need for custom Track scripts, such as ExposedReference

  • @pickgliss2498
    @pickgliss2498 Před 14 dny +2

    The unity team must hire you!!! you can make the unity must better!!!!!!

  • @lucianobisconti9078
    @lucianobisconti9078 Před 13 dny

    Excelente video y la manera en la que explicas, se aprende mucho y se aprecia.

  • @damonfedorick
    @damonfedorick Před 14 dny +2

    Nice!

  • @Krechevskoy
    @Krechevskoy Před 14 dny +1

    This is awesome 😎

  • @bazzboyy976
    @bazzboyy976 Před 13 dny

    Awesome video. It's hard for me to see how to see what benefits this solution has over the animator system though. Being able to drive everything explicitly from code is nice though.

    • @git-amend
      @git-amend  Před 13 dny

      The main benefit shown in this video is that objects can provide their own animations. You can read about some of the other advantages here: docs.unity3d.com/Manual/Playables.html

  • @hiperfx892
    @hiperfx892 Před 14 dny +1

    More devlogs please

  • @launemax
    @launemax Před 13 dny

    Tiny Bug in your code: in the BlendOut Function, the handle variable should be "blendOutHandle". @10:58

    • @git-amend
      @git-amend  Před 13 dny +1

      Good eye! I've updated the gist. Thanks.

  • @ceeayestro
    @ceeayestro Před 14 dny +1

    I might sound stupid but at what point did you assign the animations to the objects. Thats the only part that has me lost.

    • @git-amend
      @git-amend  Před 14 dny +1

      On the Interactable object there is a SerializedField for a clip, which I populated off camera.

    • @ceeayestro
      @ceeayestro Před 14 dny +1

      @@git-amend Copy. I thought i had missed something. Your videos are a ton of help.

  • @user-fm9wx4wc8h
    @user-fm9wx4wc8h Před 13 dny

    You are the Gem for the Unity Devs!
    can you share any of your game.

    • @git-amend
      @git-amend  Před 13 dny +1

      Thank you... and probably one day I'll do a few dev logs, but might not be for a while.

  • @z-time3291
    @z-time3291 Před 14 dny

    FUEGO BEBE OTRO TUTO

  • @erikafurudo9960
    @erikafurudo9960 Před 13 dny

    Is this a new API? Since which version? I didn't know this API existed; it seems really useful.

    • @git-amend
      @git-amend  Před 13 dny

      Playables has been around a long time, but for some reason it's never been promoted much by Unity. For example, Timeline, which is an big part of Unity, is based on Playable Graph.

  • @furkanunlu2177
    @furkanunlu2177 Před 14 dny +2

    Each video feels like a lesson. Thanks a lot!

  • @abclef
    @abclef Před 11 dny

    I used this API a few years ago, easy yet powerful, and people can build their customized Animator/Timeline on top of that, which is a must-have for some ACT/Rogue-like games. But the PlayableGraph Visualizer package is still in a very early stage and has been dead for years as its contributor has left Unity, making the whole thing unusable for small studios/ individuals.

    • @git-amend
      @git-amend  Před 10 dny

      It's unfortunate that the Visualizer was DOA, but to be honest I found it clunky and unnecessary.

  • @martinvanstein.youtube
    @martinvanstein.youtube Před 14 dny +1

    Great content gave you some coffee money and hope you'll do a full course ... purely for selfish reasons as I am rewriting my first game (and only game for now, called king of crokinole) to be more performant and it is hard to find actual quality content on more advanced topics.
    Any way keep up the good work !!!

    • @git-amend
      @git-amend  Před 14 dny +3

      Hey thank you so much! I appreciate the support and the awesome comment!

  • @landosilva
    @landosilva Před 13 dny

    Hey, awesome content man! Really liking what you are doing here.
    As a follow up, I would love to see a video about Timelines and ExposedReference
    Cheers!

    • @git-amend
      @git-amend  Před 13 dny +1

      Great suggestion! I've started taking some notes for a future vid!

  • @fleity
    @fleity Před 14 dny

    Playables are super mighty but the api is so little documented and not particularly transparent. Have fun blending entire time lines :-/
    (plus playable visualizer should be mentioned here)

    • @git-amend
      @git-amend  Před 14 dny

      Personally I find the visualizer clunky, but I suppose it’s better than nothing. Too bad it’s not being developed.

  • @user-rm2pj9jf8s
    @user-rm2pj9jf8s Před 14 dny

    WOW

  • @martin-schoen
    @martin-schoen Před 8 dny

    This is a great video, not only because it is the 69th :)

    • @git-amend
      @git-amend  Před 8 dny +1

      I hadn't even noticed that lol

  • @AirburstStudios
    @AirburstStudios Před 14 dny +18

    Finally a Programming-Centric CZcamsr for Unity. I always thought it's all about people using assets from the store rather than being real developers first

    • @git-amend
      @git-amend  Před 14 dny +2

      Thanks! Glad you’re here!

    • @1ulicaaNerd
      @1ulicaaNerd Před 11 dny +1

      I heard that he's an ex-worker for unity

  • @ggwp8618
    @ggwp8618 Před 14 dny

    Whenever i come to your channel i feel like i dont know shit about unity😅😅😅

    • @git-amend
      @git-amend  Před 14 dny

      Always good to fill in the gaps!

  • @nehal_chandra2777
    @nehal_chandra2777 Před 14 dny

    W

  • @midniteoilsoftware
    @midniteoilsoftware Před 14 dny

    I'm triggered by your use of "magic numbers" for the indexes (e.g. 0 for idle, 1 for walk) - :)

    • @git-amend
      @git-amend  Před 14 dny +1

      Yeah, in hindsight I should have taken the time to remedy that. Most certainly if the system were to grow any larger!

  • @Haddleton
    @Haddleton Před 10 dny

    Curious why you’re using coroutines with a custom asset instead of just using the new-ish async await support?
    EDIT: sleep-deprived brain did not see the other similar comments lol, but I’ll leave it here anyway. Async await is awesome, coroutines are so annoying lol. Glad they’re on the way out.

    • @git-amend
      @git-amend  Před 9 dny

      Since this weekend is a follow-up, and there were lots of comments about using async instead, I'll show how to quickly adapt this to use Awaitable as an alternative.

  • @reggieisnotadog4841
    @reggieisnotadog4841 Před 13 dny

    This just seems like a much worse version of Animancer. I know this is free but it's just making my investment in Animancer feel very worthwhile. Thanks for the detailed video on it!

    • @nicolasgerard2476
      @nicolasgerard2476 Před 13 dny +1

      Well animancer uses that API under the hood ;p Would be a shame if you could slap something like animance in a 10 minute video with explainations on top.