Happy Sunday! Hope everyone is still working on their projects despite summertime and FFXIV. Today's video build's on last weeks video here: czcams.com/video/fQzKJO-0dS8/video.html
Excellent video; thank you again. I absolutely love how I've just commented on the awaitable thing on the other video and it's already been answered. I'll give that optimisation stuff a read.
You can delete the reference by highlighting it and click delete no need to search, I have been using unity for almost 10 years and don't know about that till last months 😅
I certainly don't know enough yet about the specifics, but the AudioClipPlayable.Create every time you want to create a sound feels like something that should be cashed. This is simply a feeling because I know how expensive Instantiates are. This could be a complete different thing with Playables, but I would actually be very curious to see if this already the best version of this code or if you simply chose to write it like this for readability.
A few months ago I added a random animation player and I used the playables, it's nice, need to get to know it a bit. I hope the new Unity Awaitable is worth it, they pretty much just copied UniTask (Which is amazing), maybe I'll play around with the awaitable to see it performance. Great video as always, not a lot of people know about playables and I think they go quite well with programmers that like having everything setup in code and no in the inspector(like me lol).
That's interesting, someone was asking about UniTask this morning on Discord. I'd like to do a video on that and maybe discuss the pros and cons a bit, especially related to GC. Thanks for the comment! I agree, I prefer the programmatic approach as well!
@@git-amend I've been using UniTask for quite some time now. I don't have a single coroutine or Update in the whole project. It's performance is quite good, also moving between the mainthread and threadpool (Idk if Awaitable has that?). UniTask became a must in any project I start, and I also force it upon work haha. Edit: Anything by Cysharp (Who made UniTask) is pretty great, they have a lot of very nice open projects that really boost Unity in a lot of ways. (Memory Pack which we use in work and is a must for some of our use cases, that is a zero encoding binary serializer. ZString which is a zero allocation stringbuilder if you have any heavy usage on that front. Magic onion which is an RPC framework that uses interfaces to send RPC's. ZLogger for very extensive logging.)
@@leos-clockworks335 Ok, well now I'm convinced. Those other tools all sound interesting too, though admittedly I haven't used any of them. Time to do some exploring!
Hi! I have been following you for a while and u are creating great contents. Thanks for that!! I have a question. How would playables work with state machines or behaviour trees if u have lots of animations on player? How would you combine these two?
Thanks! That's a great question. My first inclination would be to create an Animation Strategy that can resolve an Animation Clip (or multiple clips), and each state in a State Machine or node in a Behaviour Tree could have it's own AnimationStrategy that could be run while in that state - the Strategy determines which animations to supply to the Playable Graph. Of course, there are always multiple ways to approach this, and it would really depend on your implementation.
Is playable a replacement to the Animator/Mecanim? Can it do animation masking where e.g we can choose which bones are influenced by an animation for situations such as to allow a character to walk while attack at the same time? This masking feature is available in Unity's default animator graph. From what I'm seeing in your past video and this follow-up, it is either we choose to use Animator or Playables. Using both at the same time/mixed responsibilities can make the whole project much more complicated and messed up.
Playables are not necessarily a replacement for an Animator, in fact you need an Animator component to play the animations, and that's the reason we pass the Animator into the methods that create the various elements needed. You can do all the same things you can do with an Animator Controller, such as masking and layers, but with more control. There is nothing wrong with combining the two, and that's what the AnimatorControllerPlayable is for. If you have simple systems that can be basic, such as a simple locomotion system, you can incorporate that and use other Playable elements to handle mixing in the more complex animations of your system.
I love you videos! I was wondering, making a multiplayer game with NGO, for animation you can just put the component NetworkAnimator to handle everything for syncing animation. Playables looks super cool, but does it mean I would need to code syncing myself? Is that a lot of work, like a player joining other players that are already in the middle of an animation, I wouldn't even know where to start!
This is a good question that I haven't had time to investigate (others have asked this too). Technically, the NetworkAnimator should sync anything played through the Animator - and the Playables are being played via the Animator, that's why we use it as a parameter during the setup. So, in theory, it should be handled. However, some brave soul needs to do a test and find out for sure. If I have a free moment at some point, I will set up a small test.
I'm currently developing combo system. After watching your great vids about using Playable, I also apply it for my animation combo system. But Im sticking in play respective animation for each skill in my combo using Playable. Can u suggest me ideas? I really appreciate this, thank u
While it's not covered in the video, you might want to consider creating a PlayableAsset for each skill's animation and dynamically blending them using a PlayableMixer. This approach allows you to sequence and blend different animations smoothly, giving you precise control over each skill's transition and timing within the combo. A PlayableAsset is a base class for assets that can be used to instantiate a Playable at runtime.
Soumds interesting, Can we use it to create Flexible State Machine behaviour for Player or Enemies/Game AI...? I am currently working on a state based behaviour for my player but the way i did it, it is not flexible to reuse it for other. It contain reference for specific classes related to player behaviour. Can playable help me in such situation...?
Yes, it is possible to use Unity Playables to create a flexible state machine behavior for players or enemies by using PlayableBehaviour to define state logic and PlayableAsset to encapsulate these behaviors. However, this approach might result in many assets in your project, which could become difficult to manage if the state machine has numerous states. Another approach that I prefer can be seen in this video: czcams.com/video/NnH6ZK5jt7o/video.html
For these two videos, there seems to be a lot of creating and destroying going on. Would it be better to use object pooling, or am I missing something?
For Unity Playables, which are structs, pooling is generally unnecessary since they are lightweight and allocated on the stack, minimizing performance overhead. The cost of managing a pool often outweighs the benefits due to their efficient creation and destruction. You would have to consider any potential optimizations in light of this.
hello sir this question is irrelevent to the video i need to make a simulation from a video like if a players kicks a ball in video i need to recreate in unity is playables good for this?? or any approach i can take i am your big follower if you can help and reply?
Hello! Playables in Unity are more suited for controlling animations and timelines rather than directly recreating real-world physics from video. For simulating actions like a player kicking a ball, you would typically use Unity's physics engine along with animation techniques rather than Playables.
Happy Sunday! Hope everyone is still working on their projects despite summertime and FFXIV. Today's video build's on last weeks video here: czcams.com/video/fQzKJO-0dS8/video.html
This is playable stuff is really cool and no one ever talks about it. Also, i vote to bump the profiler /optimization video up on the queue!
Yeah, I'm thinking that should be next on the priority list. There are so many unanswered questions about GC and async operations.
Nice!
Excellent video; thank you again. I absolutely love how I've just commented on the awaitable thing on the other video and it's already been answered. I'll give that optimisation stuff a read.
Awesome, glad to hear it.
I cant thank you enough for your knowledge, and amazing tutorials! 👍
Love to hear that, thank you!
Another cool video about something no one talks about it! I want to see more.
Thanks!
Love that udate and system extension. Great job with all of yours tutiorials Adam :)
Thanks so much!
Nice!
Wow I'm early, and this is surprisingly relevant to my current project
Great, glad to hear that!
Nice!
You can delete the reference by highlighting it and click delete no need to search, I have been using unity for almost 10 years and don't know about that till last months 😅
Haha I thought about that right after too. Great tip!
I certainly don't know enough yet about the specifics, but the AudioClipPlayable.Create every time you want to create a sound feels like something that should be cashed. This is simply a feeling because I know how expensive Instantiates are. This could be a complete different thing with Playables, but I would actually be very curious to see if this already the best version of this code or if you simply chose to write it like this for readability.
All Playables are structs and allocated on the stack. However, if necessary you can certainly cache it as well.
Very insightful!
Thank you!
A few months ago I added a random animation player and I used the playables, it's nice, need to get to know it a bit.
I hope the new Unity Awaitable is worth it, they pretty much just copied UniTask (Which is amazing), maybe I'll play around with the awaitable to see it performance.
Great video as always, not a lot of people know about playables and I think they go quite well with programmers that like having everything setup in code and no in the inspector(like me lol).
That's interesting, someone was asking about UniTask this morning on Discord. I'd like to do a video on that and maybe discuss the pros and cons a bit, especially related to GC. Thanks for the comment! I agree, I prefer the programmatic approach as well!
@@git-amend I've been using UniTask for quite some time now. I don't have a single coroutine or Update in the whole project.
It's performance is quite good, also moving between the mainthread and threadpool (Idk if Awaitable has that?).
UniTask became a must in any project I start, and I also force it upon work haha.
Edit: Anything by Cysharp (Who made UniTask) is pretty great, they have a lot of very nice open projects that really boost Unity in a lot of ways. (Memory Pack which we use in work and is a must for some of our use cases, that is a zero encoding binary serializer. ZString which is a zero allocation stringbuilder if you have any heavy usage on that front. Magic onion which is an RPC framework that uses interfaces to send RPC's. ZLogger for very extensive logging.)
@@leos-clockworks335 Ok, well now I'm convinced. Those other tools all sound interesting too, though admittedly I haven't used any of them. Time to do some exploring!
Hi! I have been following you for a while and u are creating great contents. Thanks for that!! I have a question. How would playables work with state machines or behaviour trees if u have lots of animations on player? How would you combine these two?
Thanks! That's a great question. My first inclination would be to create an Animation Strategy that can resolve an Animation Clip (or multiple clips), and each state in a State Machine or node in a Behaviour Tree could have it's own AnimationStrategy that could be run while in that state - the Strategy determines which animations to supply to the Playable Graph. Of course, there are always multiple ways to approach this, and it would really depend on your implementation.
Is playable a replacement to the Animator/Mecanim?
Can it do animation masking where e.g we can choose which bones are influenced by an animation for situations such as to allow a character to walk while attack at the same time? This masking feature is available in Unity's default animator graph.
From what I'm seeing in your past video and this follow-up, it is either we choose to use Animator or Playables. Using both at the same time/mixed responsibilities can make the whole project much more complicated and messed up.
Playables are not necessarily a replacement for an Animator, in fact you need an Animator component to play the animations, and that's the reason we pass the Animator into the methods that create the various elements needed. You can do all the same things you can do with an Animator Controller, such as masking and layers, but with more control. There is nothing wrong with combining the two, and that's what the AnimatorControllerPlayable is for. If you have simple systems that can be basic, such as a simple locomotion system, you can incorporate that and use other Playable elements to handle mixing in the more complex animations of your system.
I love you videos! I was wondering, making a multiplayer game with NGO, for animation you can just put the component NetworkAnimator to handle everything for syncing animation. Playables looks super cool, but does it mean I would need to code syncing myself? Is that a lot of work, like a player joining other players that are already in the middle of an animation, I wouldn't even know where to start!
This is a good question that I haven't had time to investigate (others have asked this too). Technically, the NetworkAnimator should sync anything played through the Animator - and the Playables are being played via the Animator, that's why we use it as a parameter during the setup. So, in theory, it should be handled. However, some brave soul needs to do a test and find out for sure. If I have a free moment at some point, I will set up a small test.
Nice!
Thank you! Cheers!
I'm currently developing combo system. After watching your great vids about using Playable, I also apply it for my animation combo system. But Im sticking in play respective animation for each skill in my combo using Playable. Can u suggest me ideas? I really appreciate this, thank u
While it's not covered in the video, you might want to consider creating a PlayableAsset for each skill's animation and dynamically blending them using a PlayableMixer. This approach allows you to sequence and blend different animations smoothly, giving you precise control over each skill's transition and timing within the combo. A PlayableAsset is a base class for assets that can be used to instantiate a Playable at runtime.
Soumds interesting, Can we use it to create Flexible State Machine behaviour for Player or Enemies/Game AI...?
I am currently working on a state based behaviour for my player but the way i did it, it is not flexible to reuse it for other. It contain reference for specific classes related to player behaviour.
Can playable help me in such situation...?
Yes, it is possible to use Unity Playables to create a flexible state machine behavior for players or enemies by using PlayableBehaviour to define state logic and PlayableAsset to encapsulate these behaviors. However, this approach might result in many assets in your project, which could become difficult to manage if the state machine has numerous states. Another approach that I prefer can be seen in this video: czcams.com/video/NnH6ZK5jt7o/video.html
For these two videos, there seems to be a lot of creating and destroying going on. Would it be better to use object pooling, or am I missing something?
For Unity Playables, which are structs, pooling is generally unnecessary since they are lightweight and allocated on the stack, minimizing performance overhead. The cost of managing a pool often outweighs the benefits due to their efficient creation and destruction. You would have to consider any potential optimizations in light of this.
@@git-amend Ah, I was missing something. Thanks!
hello sir this question is irrelevent to the video i need to make a simulation from a video like if a players kicks a ball in video i need to recreate in unity is playables good for this?? or any approach i can take i am your big follower if you can help and reply?
Hello! Playables in Unity are more suited for controlling animations and timelines rather than directly recreating real-world physics from video. For simulating actions like a player kicking a ball, you would typically use Unity's physics engine along with animation techniques rather than Playables.