Animate like a Programmer

Sdílet
Vložit
  • čas přidán 31. 05. 2024
  • As a programmer, using the Unity animator can feel like you're losing some control over your game. We can manage our animation transitions entirely from code... Animation will feel as natural as your player controller script.
    Code: bit.ly/3P4DdA2
    I'll be expanding this code on my ultimate 2D controller, which can be found here: / tarodev
    Animancer: assetstore.unity.com/packages...
    ❤️ Become a Tarobro on Patreon: / tarodev
    =========
    🔔 SUBSCRIBE: bit.ly/3eqG1Z6
    🗨️ DISCORD: / discord
    ✅ MORE TUTORIALS: / tarodev

Komentáře • 699

  • @Norbingel
    @Norbingel Před rokem +1511

    I wasn't convinced until I saw I could bypass trying to line up the animator arrows in the grid

    • @ShinichiKudoQatnip
      @ShinichiKudoQatnip Před rokem +11

      Exactly!

    • @blameyourm8519
      @blameyourm8519 Před rokem +2

      hahaha

    • @11sveden12
      @11sveden12 Před rokem +33

      I'm comforted knowing I'm not the only one driven crazy by this. I also spend way more time in Shader Graph lining up nodes than I do making actual shaders...

    • @LeeTwentyThree
      @LeeTwentyThree Před rokem +2

      this saves me soooooo muuuuuuuchhhh tiiiime i love this video

    • @mariyamrifa406
      @mariyamrifa406 Před 10 měsíci

      ​@@blameyourm8519😊p . ;blue🔵 h😊) gF/+0=°Phl de₹

  • @Loonievg
    @Loonievg Před rokem +567

    As a programmer learning game making in Unity I really like this. Now, if only there was a "How to create art/animations as a programmer"

    • @Tarodev
      @Tarodev  Před rokem +278

      Oh mate... If you find it, let me know

    • @neintonine
      @neintonine Před rokem +8

      You can add StateMaschineBehaviours to your Animator states. That way you can programmatically create animations.
      It is a bit finiky tho. f.E. the duration of the animation is set by the animation set in the state. There is a default duration you can just repeat or you just add a empty animation with your desired duration or you just use your animation and use it to spice up that animation.
      Plus there is no transitioning, what makes the creation of good animations hard.
      Transforms, you want to change, must not have any data in the animation you set.
      In general I would use this feature for simple animations like idle bobing or for stuff that has the same start and end point like firing a weapon.
      I personally believe it wasn't really designed for that.
      Sadly I haven't found a good package, that adds new features for such an use-case.

    • @progress_games
      @progress_games Před rokem +5

      Program a bot to scrape assess from pre existing games

    • @kazukixe
      @kazukixe Před rokem +3

      Asset store?

    • @jasondads9509
      @jasondads9509 Před rokem +6

      Dalle 2?

  • @lvlGhostlylvl
    @lvlGhostlylvl Před rokem +135

    I love how this video is under 2 minutes. Quick and straight to the point. Personally, I prefer the tree and have spent a great amount of time mastering it, but for quick prototypes and game jams this would be WAY faster to set up compared to messing with the tree.

    • @Tarodev
      @Tarodev  Před rokem +13

      Glad you enjoyed the short form content brother 🙏

    • @Glooberloob
      @Glooberloob Před rokem +2

      What do you prefer about the graph/tree? I've only made a couple small projects in Unity, but this approach seems much more convenient to me. Would it be a problem with scale?

    • @KeybiKeyboard
      @KeybiKeyboard Před rokem +3

      @@Glooberloob The strength of the graph/tree I believe would be helpful for 3D games such as combo-ing and whatnot. Also, the Finite State Machine Behavior can be more easily used in conjunction with the graph/tree (I think, correct me if I'm wrong but I find it easier to fix there especially with AI)

  • @spicyshotz
    @spicyshotz Před rokem +114

    I've only found your channel yesterday but already you are in my top 5, short and to the point. Keep up the good work!

    • @Tarodev
      @Tarodev  Před rokem +45

      Aiming for that #1 spot

    • @spicyshotz
      @spicyshotz Před rokem +5

      @@Tarodev Im sure you'll get there in no time 😉

    • @leukk_
      @leukk_ Před rokem +10

      @@Tarodev You'll get there for sure, i love the fact that you cover "intermediate" / "advanced" topics as well that don't necessarily bring you as many views but are much more useful than having 1000 + 1 character controller tutorials

    • @natickgames1821
      @natickgames1821 Před rokem

      Come hang out in his discord!

    • @GameDeveloperTR
      @GameDeveloperTR Před 9 měsíci

      Which channels are currently in the top 5?

  • @kozinskiandrzej4
    @kozinskiandrzej4 Před rokem +12

    I am working on animations literally this second. God sent you

  • @lDominicl
    @lDominicl Před rokem +116

    "I read every single one of them."
    WELL THEN, I HAVE SOMETHING TO SAY TO YOU.
    that's a very well done video and I appreciate the time and effort that it must have taken to make it.

    • @Tarodev
      @Tarodev  Před rokem +19

      Oh... Well thank you sir

  • @freezeboy13
    @freezeboy13 Před rokem +7

    More tutorials need to be like this, immediately explaining what you want to show off without fluff. Amazing vid

  • @hegworks
    @hegworks Před rokem +1

    I always appreciate seeing new approaches to the same repetitive things I've been doing all the time.
    Thanks mate🐦

  • @susanollington5257
    @susanollington5257 Před rokem +2

    Thank you so much for posting videos for intermediate level coding, it’s just what I need!

  • @pianoatthirty
    @pianoatthirty Před rokem +30

    This is so interesting. I would seriously love to learn more about how to implement this. It seems so clean and efficient. Every 2D tutorial I’ve seen just talks about the regular ‘spiderweb’ way.

    • @SolChaos-ph7ye
      @SolChaos-ph7ye Před 3 měsíci

      You seriously limit yourself if you animate this way. However, you shouldn't have spiderwebs in the animation graphs either. Once you learn the animation graphs system you will have clean clear animation states using layers, substates, and blend trees. the spiderweb only comes from lack of experience. animating in code as shown in this video is not recommended.

    • @andrueanderson8637
      @andrueanderson8637 Před 26 dny

      “Clean”? This literally leads to ridiculous repetition and duplication in your code. It’s the opposite of clean.

  • @darkfafi
    @darkfafi Před rokem +3

    Have been programming in Unity for over 6 years and always wrote my own animation system to avoid the issues addressed in this video.
    I never heard of CrossFade, this would have solved everything I solved writing my own systems while keeping it connected to the tools Unity Provided. Thank you for showing this!
    To return the favor, let me address the following thing I noticed about the video:
    About the animation states. I categorize finite state machines into 3 categories:
    Level 1: Tracking state by multiple booleans
    Level 2: Tracking state by an enum
    Level 3: Tracking state / having the logics of states in separate classes.
    You were using a Level 1 Finite State Machine. I highly recommend going for a Level 2 or Level 3 Finite State Machine.
    The nice thing about having it in separate classes is that you can do simple things such as:
    * WalkingStateClass (holds logics of walking)
    * FreezeStateClass (changes color when entered, and back when exited)
    And to have the player freeze when hit by an object, you only have to:
    CurrentState.Exit();
    CurrentState = new FreezeStateClass();
    CurrentState.Enter();
    Because WalkingStateClass is no longer CurrentState, it no longer is being updated so no walking logics is available anymore. Keeping your behaviour simple and preventing complicated bugs.

    • @Tarodev
      @Tarodev  Před rokem +2

      Very interesting. Thanks for the write up 🙏

  • @conedome6845
    @conedome6845 Před rokem +1

    I really love your videos man, short and to the point. I’m a little confused on 3D animation but honestly the more I think about how to implement it the more I think I can

    • @Tarodev
      @Tarodev  Před rokem

      If anything 3D animation is a bit easier as you can interpolate frames between two animations (this is handled automatically) to create smooth transitions. You can do it brother!

  • @getintheoven
    @getintheoven Před 3 měsíci

    had to come back with a new channel because the game i was working on last year uses your character controller... thank you for existing btw! hope you're overcoming any stress you're dealing with at this current point in time and that this year goes great for you :)

  • @MarkRiverbank
    @MarkRiverbank Před rokem +9

    +1 for Animancer Pro, it makes working with animations programmatically so much easier. And, even solves some awful blendtree glitchiness by letting you disable foot IK on a per-animation basis. Technically, another option is directly implementing the somewhat abandoned Playables API which Animancer uses behind the scenes.

  • @mishaslizhov1056
    @mishaslizhov1056 Před rokem +1

    Yo, that was extremely helpful, I saw a video from lost relic games talking about the concept of coding animations, but you took it to the next level

  • @RedCabinGames
    @RedCabinGames Před rokem

    Thank you! I didn't know about this feature! I already have a state machine in code to manage transitions and trying to match the Unity animator with it was painful. This just works with basically one line of code! I think about this video almost daily and feel thankful for it :)

  • @synchaoz
    @synchaoz Před rokem +19

    I switched to code-driven animation almost from day 1 of learning Unity after seeing LRG's tutorial on how to avoid Mekanim spiderweb madness. I barely even know how to use the Unity animator at this point. Your string hash to int trick is something I have not been doing though, until now! Thanks!

    • @gamedevteacher7065
      @gamedevteacher7065 Před rokem

      Got a link to that video?

    • @synchaoz
      @synchaoz Před rokem

      @@gamedevteacher7065 czcams.com/video/nBkiSJ5z-hE/video.html&ab_channel=LostRelicGames
      Simple little string based animator state machine. I've extended it a bit for personal use and even implemented parts of yours, but John's does a fine job even just out-of-the-box

  • @francescagreetham1804
    @francescagreetham1804 Před rokem +1

    This is sooo handy! Definitely going to play around with this. Thank you!

  • @cr4zyhand581
    @cr4zyhand581 Před rokem +5

    You can take this a step further by using Scriptable Objects to create states and then having a State Machine Monobehaviour. This way you can link up states to different animations which is particularly handy for games with multiple playable characters and generally works better as a more modular methodology than the firewall

    • @Tarodev
      @Tarodev  Před rokem +4

      I actually love that!

  • @maxnibler6090
    @maxnibler6090 Před 10 měsíci +2

    Im getting into unity with some friends. Im a professional programmer but this is my first real foray into game dev. My friends are all artists so I handle all the code. This channel is everything I want. I can figure out how to do nearly everything from the docs but never really know if Im following good practice. Most tutorials have been worthless because theyre not written for or by programmers. Loving you channel because its exactly what Ive been looking for

    • @Tarodev
      @Tarodev  Před 10 měsíci +2

      I'm here for you 🙏 enjoy your journey

  • @fmproductions913
    @fmproductions913 Před rokem +1

    Really like this idea tbh. In the past years, for a few of my games were animation transitions aren't that relevant, I always just made a state machine that is used in the MonoBehaviour and just play and adjust animation state in the logical states, kinda like you showed in the video. It prevents a lot of the pains of having to deal with the Animator and having to maintain 2 different state machines. More recently I also worked on a small editor script that basically generates the hashes of the animator state names and parameters as static variables into a file, that's pretty useful as well ^^

  • @stevennassef
    @stevennassef Před rokem +2

    I really love your videos, they always have interesting topics actually.

  • @WeenieWalkerGames
    @WeenieWalkerGames Před rokem +2

    Wow, that looks a lot easier to follow than the spider-webs with parameters that you can't tell apart. I'll also have to look into that string hash thing you used; never heard of that one.

  • @mattkaiser8984
    @mattkaiser8984 Před rokem +1

    😭 the line… you just touched my heart. That line drove me insane for so long. I hate it.

  • @MidasButSilver
    @MidasButSilver Před rokem

    This Channels like finding a hidden gem, informative and quick to the point. Nice content

  • @LostRelicGames
    @LostRelicGames Před rokem +20

    Great video! I'm glad to see more devs promoting this approach. The mechanim is a clunky and unessessary system (for coders).

    • @Tarodev
      @Tarodev  Před rokem +10

      You know, I've watched most of your videos, but somehow missed the one on this topic. Another commenter mentioned they originally learned it from you, so I went and watched it swiftly 😂
      Love your stuff man!

  • @xena-spectrale
    @xena-spectrale Před rokem

    This tip is so simple yet so effective. It just pulled me out of a full half-day unity animator nightmare. Thanks Tarodev 💙

  • @iHeartGameDev
    @iHeartGameDev Před rokem +1

    So much information condensed into a video that's under 2 minutes. Beautiful Taro! And now it feel like a ton of my videos should be refactored to use this method of animating XD

    • @pedrinkss
      @pedrinkss Před rokem

      Combining this with the state machine that you showed us = gold!

    • @glassmarble996
      @glassmarble996 Před rokem

      maybe you make a video about this.would be good.

  • @pliniomourao
    @pliniomourao Před rokem +1

    Simple, objective and precise.
    Thank you Tarodev!

  • @simonwahlstrom1296
    @simonwahlstrom1296 Před rokem +1

    I work as a software developer and I'm just starting to get into game development in my free time. This was perfect for me as I prefer to use code over Unity tools if it makes the process simpler, which this really does. Thank you!

  • @bruggles1135
    @bruggles1135 Před rokem

    This is absolutely fantastic, thank you so much! I love doing things through scripting, it just makes so much more sense in my head, and I feel like I have so much more control over how I do things. Never going back to spaghetti trees lol.

  • @SalehGfx
    @SalehGfx Před rokem +1

    Good job making this video, I feel the YT algorithm read me my mind and showed me this when I needed it.

  • @MujjMujj
    @MujjMujj Před rokem +2

    What an amazing video, this is so much better than trying to fiddle with the unity ui

  • @obo7172
    @obo7172 Před rokem +1

    Amazing idea. Animated transitions have not been relevant for some of my games over the past few years. I just created a state machine for the MonoBehaviour and just played and adjusted the animation state in the logic state like you showed in the video. It avoids many of the problems of dealing with animators and having to maintain two different state machines.

  • @gunhann
    @gunhann Před rokem +1

    I'm relieved that I'm not alone to align horizontally the animator connection lines :D

  • @mrstruijk
    @mrstruijk Před rokem +1

    This is super useful! More of this please :)

  • @matthewsmith2682
    @matthewsmith2682 Před rokem +1

    I'd like to understand ANYTHING you just said. Well done mate.

  • @FakeMelon
    @FakeMelon Před rokem

    I love your videos, you just get the point so efficiently. thanks.

  • @atmegaphil
    @atmegaphil Před rokem +1

    thank you! This reminded me of a tutorial i watched last summer from Kiwicoder but in 3D. Programming animations this way seems the cleanest way.

  • @sapientunderground
    @sapientunderground Před rokem +5

    Good stuff, I use a very similar system for a 2.5D platformer project, the level of control is very good to have, and no animation/transition setup overhead.

  • @theonlycatonice
    @theonlycatonice Před rokem +4

    LockState is probably what I needed. I followed LostRelics version of this in a lil endless runner I made and I noticed animations being overridden. So in the animator I linked necessary ones back to idle, also turning off the autoloop, and then in my if statement checking player states, I stop/prevent the state changing unless it's not one of those animation states. E.g. player is landing from a jump, even if they are grounded, I don't want idle to play since I want the jump animation to finish, if not jumping play idle but when jump is finished in the animator it will go back to idle. Your LockState example essentially does what I wanted 👌
    Also I wish beginners knew of this because Unitys spider web is a nightmare and I can't see an advantage over just coding it.

  • @TheDoomLordd
    @TheDoomLordd Před rokem +1

    Bookmarking this for the future as i think ill never use the built in animator window ever again

  • @Glooberloob
    @Glooberloob Před rokem +1

    thank you so much for sharing this. it seems like a much easier way to animate considering i always just set up animation triggers and call them one by one. and great presentation too!

  • @williamhiciano394
    @williamhiciano394 Před rokem +1

    this is absolutely awesome did not know about this, thanks !

  • @ProdigiaGames
    @ProdigiaGames Před rokem +2

    Good stuff! My current game is a track- based music game so all of my character animating is being done on the timeline for this one, but I'll definitely keep this in my bag of tricks for future projects. The more you can calculate programatically, the better!

    • @Tarodev
      @Tarodev  Před rokem +1

      This strategy seems ideal for that type of game, so long as you have events being fired for the beats

    • @ProdigiaGames
      @ProdigiaGames Před rokem +1

      @@Tarodev Actually, that makes sense. I was just going to make manually animated segments with timeline triggers to branch/loop, but that could potentially help automate at least some of the animation setup. I'll have to weigh my options!

  • @AetherXIV
    @AetherXIV Před rokem +1

    Always love your stuff. Best unity tut tuber

  • @Khaldryn
    @Khaldryn Před rokem +1

    This is amazing! Getting rid of transitions and blend trees is a god send. I work exclusively with pixel art games and this is a perfect solution to the spider web woes I continue to deal with. This method is simple and intuitive. As a newb to game dev, a more detailed video doing a deep dive into creating the script and going through some different interactions of the code with various actions like attacking, jumping, et cetera, would be great. Thanks for the code and the quick video on how it all works.

    • @Tarodev
      @Tarodev  Před rokem

      I'd love to hear how you go with it. Reply here when you've had a play 😊
      I have a pretty fleshed out version on my patreon if you're ever interested

  • @ofa44332
    @ofa44332 Před rokem +2

    This is so helpful. As someone coming to Unity from GameMaker Studio, this is really similar to how animation is done there. So much easier for sprite work!

    • @Tarodev
      @Tarodev  Před rokem +1

      I wasn't aware of that, interesting

  • @hmzaelmkd
    @hmzaelmkd Před rokem +10

    this looks a lot easier than working with unity animator, it would be great to see a full tutorial on this!

    • @Conor_Tuohy
      @Conor_Tuohy Před rokem +6

      Yes - an explanation of your full code, and what connects to what components, what terms or commands actually do, why you use the techniques and code you use, etc - that'd be very useful to us folk just starting out!

  • @NickMaltbie
    @NickMaltbie Před rokem +2

    This is marvelous

    • @Tarodev
      @Tarodev  Před rokem +1

      Good luck brother! Remember, the provided script is still basic. You can deck it out with some advanced features like OnFinish and OnStart events

    • @NickMaltbie
      @NickMaltbie Před rokem

      @@Tarodev I have a state machine based character controller so I already have all the transitions mapped out! Thinking of switching it to coyote based state machines so I can decorate the states with attributes on what animation to switch to when loaded!

  • @646AWESOME
    @646AWESOME Před rokem +5

    I highly recommend using Playables graphs for 3d animation. It's built into unity (but with little documentation) and offers even more programmer centric design. For instance, you can use animation clips as serialized fields and reuse animation graphs just like you reuse code.
    There is extra work needed to get it set up but it gives you so much more control. It also let's you customize transitions so they're not linear!

    • @mufelo
      @mufelo Před rokem +1

      Animancer takes away most of the extra work and uses playables in the backend.

  • @TurboMakesGames
    @TurboMakesGames Před rokem

    Crossfade is new to me, this seems right up my alley. Great video man 👊👊

  • @PitiITNet
    @PitiITNet Před rokem +1

    Mr Taro, that is fantastic video! Thank you so much for it :D. I had no idea this method exists!

  • @calebgilbertyt
    @calebgilbertyt Před rokem

    This was really helpful, I'm just not a big fan of the unity animator, and my brain works very logically, so I will be using this method a lot more, thanks so much!

  • @user-cu5ky8qz2n
    @user-cu5ky8qz2n Před rokem +1

    Amazing work, bro !

  • @StarshipJais
    @StarshipJais Před rokem +1

    This was helpful and motivating, thanks.

  • @mrcroco5121
    @mrcroco5121 Před 10 měsíci

    this channel is a blessing ..honestly. superb content.

    • @Tarodev
      @Tarodev  Před 10 měsíci

      Thank you ❤️

  • @M4nichean
    @M4nichean Před rokem

    You had me at OCD, really enjoying your vids man keep it up PLEASE. Learning lots even started making my own space shooter!

    • @Tarodev
      @Tarodev  Před rokem

      Hell yeah brother!! Good luck with the shooter

  • @noodle-eater
    @noodle-eater Před rokem +1

    I just know this API after a few years working with unity, thank you this is looks awesome.

  • @viramyar4259
    @viramyar4259 Před rokem

    Hey TaroDev! Great video, honestly struggled with animations and the damn spider webs way too much. Actually checked you out after the blackthornprod 3d game dev video, you were a complete machine in that! Thanks for the video mate, have a good one!

    • @Tarodev
      @Tarodev  Před rokem +1

      Welcome aboard mate 😊
      I've had a bunch of complaints that I threw out too many previous dev implementation in that video, lol.
      Woops.

    • @viramyar4259
      @viramyar4259 Před rokem +1

      @@Tarodev all good mate, p.s I liked your changes

  • @firstvf
    @firstvf Před 4 měsíci

    Didn't expect that 2 minutes video could be so useful.. You are genius, thanks!🙂

  • @nahuelhemsi
    @nahuelhemsi Před 2 měsíci

    Keep the good vids, amazing!

  • @lp-games
    @lp-games Před rokem +1

    Oh man! Thank you so much... I love this!

  • @matteomanicone5717
    @matteomanicone5717 Před rokem +1

    Thank you. I converting the state to hash looks like a good idea and it could be used for an enum. Can't wait to test it out.

    • @Tarodev
      @Tarodev  Před rokem

      Just ensure you're still sending the hash to the animator as it's significantly more efficient

  • @voodoo5191
    @voodoo5191 Před rokem

    I always had so much trouble with animator in unity. This video is great!

  • @SidusBrist
    @SidusBrist Před rokem +1

    This is sooo useful, thank you sir

  • @eliphillips4392
    @eliphillips4392 Před rokem +1

    What an effective, quick video.
    Humour, bit size and taught well.

  • @ilikesnow
    @ilikesnow Před rokem +1

    It's like you were sitting across the "office" from me today! I've been struggling the past week with this exact scenario but 3D. Thank you so much sir.

  • @JamesMakesGamesYT
    @JamesMakesGamesYT Před rokem +1

    Great video Taro! Never heard of CrossFade or the firewall pattern before this, definitely have to try them out

    • @Tarodev
      @Tarodev  Před rokem

      You've never heard of the firewall pattern as I coined it while writing the script :D

    • @JamesMakesGamesYT
      @JamesMakesGamesYT Před rokem

      @@Tarodev Well now I don't feel too out of the loop :D

    • @gogokowai
      @gogokowai Před rokem

      The standard name for the "firewall pattern" is "guard clauses". It normally refers to returning after checking function parameters for valid values, but can also refer to a string of conditionals and return statements. Firewall pattern sounds cooler, but it might be a confusing term if you're writing network code.

  • @TheCraftyDodger
    @TheCraftyDodger Před rokem

    Another great video! Can we have your take on creating an inventory system? I know this has been done many times before but I love how simple you make complex topics and I'm sure you'll do a fantastic job with inventory. Covering things such as; Setting up the inventory, drag and drop functions on it, reactive UI based on what you have picked up / dropped and maybe some extras such as combining items from that inventory (for example, crafting.) Because these things are used in many games.

  • @DePistolero
    @DePistolero Před rokem +1

    Incredible content!!! Feel like a beginner watching your videos!!! Grow that channel!! Grow like crazy!!!

    • @Tarodev
      @Tarodev  Před rokem

      I'm tryyyyyyiiiinnnnngggg 😂

  • @syroin123
    @syroin123 Před rokem +1

    "Tell me anything" you say?
    Well, the mitochondria is the powerhouse of the cell.

  • @bobbymcbobface
    @bobbymcbobface Před rokem +1

    I've been looking for something like this!

  • @mateoballa149
    @mateoballa149 Před rokem +1

    Awesome video Taro!
    Would you mind giving some insight on the "Cached Properties" ? I understand the goal is to calculate them once and store them, but by making them static im not sure when it would be computed (during creation of the first object of that class?)

  • @dantemarinucci8765
    @dantemarinucci8765 Před rokem +1

    This is so helpful!!

  • @mayankbhaisora2699
    @mayankbhaisora2699 Před rokem +1

    Thank you man 🖤

  • @the3rdr0b0t
    @the3rdr0b0t Před rokem +1

    I thought this was an asset you made and wanted to show off but no, this is straight up base unity functions. How has this evaded me for so long?!?!

    • @Tarodev
      @Tarodev  Před rokem +1

      It evaded many of us... But we now have the power.

    • @the3rdr0b0t
      @the3rdr0b0t Před rokem +1

      @@Tarodev I will follow you to the ends of the earth, finder of ancient treasures

  • @ZacIRL
    @ZacIRL Před rokem

    How would you override a locomotion blends idle/walking animations in this method? E.g. depending on the weapon the char holds or how tired he is?
    Would you override animations at all?

  • @GMax17
    @GMax17 Před rokem

    Brilliant stuff

  • @eerongal
    @eerongal Před rokem +1

    Probably outside of the scope of a quick vid like this, but if you're using a state machine pattern within your own code, changing animations like this can easily be handled more elegantly than a block of if statements, ESPECIALLY if your animation is tied to state.
    Just have some sort of "onStateEnter" function on your states where you set your animation.

    • @Tarodev
      @Tarodev  Před rokem

      I use state machines all the time, but I like my current approach more. Way (way) less boilerplate, exact same result.

  • @UnknownRealityz
    @UnknownRealityz Před rokem

    Great job as always! by the way thanks to you that you made me understand i have OCD

  • @lamarhoward8478
    @lamarhoward8478 Před rokem +1

    Yoooo 🤯 this is literally exactly what I need after just deciding today to make my platformer 2.5D with models instead of 2D with the same models baked as sprites. Nice 🤝🏾

    • @Tarodev
      @Tarodev  Před rokem +1

      I love 2.5D. Good luck with your project!

    • @lamarhoward8478
      @lamarhoward8478 Před rokem +1

      @@Tarodev Thanks, good luck with your projects as well 👍🏾

  • @BrainDeadSlime
    @BrainDeadSlime Před rokem +1

    That's an easy sub for sure. Gonna try this sometime soon

  • @IDENTICYEA
    @IDENTICYEA Před rokem +1

    dude that perfect thank you!

  • @9mingus
    @9mingus Před rokem +1

    Brilliant!

  • @GregoryLepers
    @GregoryLepers Před rokem +1

    Hi, nice tutorial, very well done.
    Can i ask why you use the CrossFade() function rather than the Play() function, especially if you don't use transition time?
    Thanks.

  • @brensenvillegas7177
    @brensenvillegas7177 Před rokem +1

    excellent vid!

  • @EnterpriseKnight
    @EnterpriseKnight Před rokem +1

    I gotta test this one

  • @jaylahouse5100
    @jaylahouse5100 Před rokem +1

    Omg this is everything I ever needed as a programmer. Thank you

  • @escapegoat573
    @escapegoat573 Před rokem +1

    how do you bump the player up when he undershoots a jump in a platformer?

  • @ZacIRL
    @ZacIRL Před rokem +5

    Do you think i can still transition to that animation approach in a big project? Im handling quite a bit in the animator.
    I basically run the the state machine in the animator but transitions to hit and death animations are always so clunky, that the combat feel really suffers I feel.
    If you’d transition to the programmer approach, would you implement something else than a switch-case based FSM?

    • @Tarodev
      @Tarodev  Před rokem +1

      I believe this would scale quite well. I did it as a decoupled script using an interface, but you can place this logic directly within your controller code, which would reduce boilerplate by quite a lot.

    • @ysftulek
      @ysftulek Před rokem +1

      but again, if you implement a FSM for handling states, you are already doing what Unity did in the first place. I think you can also watch a gdc video called "Animator Hell" where a developer gives tips and tricks for handling lots of animations.

    • @ysftulek
      @ysftulek Před rokem +1

      I think when it's understood FSM approach of Unity is quite nice. Just pay attention to the layers, blend trees and state trees(I guess? you can put multiple states inside for organizing)
      for exp: you can use blend trees for different attacks and you would transition between attack animating blend value, then you can specify time it takes to blend into that value, that way you could control the transition speed.

  • @kaspedkk
    @kaspedkk Před rokem

    ooh, nice man. Thanks for that. I both hate and love unitys animation tools. But this will help me a bunch!

  • @bumbowo
    @bumbowo Před rokem +2

    YOU MY MAN ARE SPEAKING MY LANGUAGE

  • @skymanito
    @skymanito Před rokem +2

    you are a fooking legend!

  • @ggain1008
    @ggain1008 Před rokem +1

    Thank you so much!

  • @arielnunez5795
    @arielnunez5795 Před rokem

    Wowwww i wanted to know this before, really thank you

  • @alejandropulidorodriguez9723

    Animate like a programmer is such a powerful sentence. Draw like a skilled math teacher

  • @mehmedcavas3069
    @mehmedcavas3069 Před rokem +1

    wow thought this is a tool or something like that, but the animator itself has it. how did I not see this for all these years :D

  • @LookiePookie
    @LookiePookie Před rokem

    this is super helpful thanks 🙏

  • @mehdiali8187
    @mehdiali8187 Před rokem +2

    Great content as always, one of the best Unity and c# channels. I discovered Crossfade lately and started using it, a great tool, way better then the graphical setup.
    Will you eve do a Fish Net Overview / Tuto or any content related to it ?

    • @Tarodev
      @Tarodev  Před rokem +2

      I may do a NetCode/FishNet comparison video, but won't do a full blown FishNet tutorial. If you're after related content, checkout my recent NetCode video.