2D Animation in Unity (Tutorial)

  Рет қаралды 2,423,033

Brackeys

Brackeys

5 жыл бұрын

Let’s animate our character!
● Check out Skillshare: skl.sh/brackeys8
● Watch Player Movement: • 2D Movement in Unity (...
● Download the Project: bit.ly/2KK5AG8
● Character Controller: bit.ly/2MQAkmu
● Get the 2D Sprites: bit.ly/2KOkwjt
❤️ Donate: www.paypal.com/donate/?hosted...
····················································································
♥ Subscribe: bit.ly/1kMekJV
► Join Discord: / discord
● Website: brackeys.com/
● Facebook: / brackeys
● Twitter: / brackeystweet
········································­­·······································­·­····
► All content by Brackeys is 100% free. We believe that education should be available for everyone.
❤️ Donate: www.paypal.com/donate/?hosted...
········································­­·······································­·­····
♪ "ES_Freekin'_Fretless_3" - Mattias Andreasson" by Epidemic Sound
♪ "ES_Dress Code_Black - oomiee" by Epidemic Sound

Пікірлер: 3 000
@ElS3rna
@ElS3rna 3 жыл бұрын
oh boy, if it took brackeys 20 minutes, im gonna be here till tomorrow
@austinlee7691
@austinlee7691 3 жыл бұрын
SAAAMEE
@TheDiamondMc88
@TheDiamondMc88 3 жыл бұрын
Good one
@deleteduserontop2b2t22
@deleteduserontop2b2t22 3 жыл бұрын
no brackeys can do it in 5 minutes but he explains while showing you stuff to do
@cheeselover0743
@cheeselover0743 3 жыл бұрын
what 1 day? wow thats fast i am here for a month
@anoop_brar
@anoop_brar 3 жыл бұрын
Same
@Ball_Zach
@Ball_Zach 2 жыл бұрын
If you need to press space 2 times to play the animation, You need to go in the CharacterController2D script and change on the line 130 the false to true. Hope this Helped!
@frederiksommer8171
@frederiksommer8171 2 жыл бұрын
Thanks :)
@greganimations3366
@greganimations3366 2 жыл бұрын
Thank you very much :D
@luffymaster47
@luffymaster47 2 жыл бұрын
Tx
@luffymaster47
@luffymaster47 2 жыл бұрын
(130)
@JHawkins
@JHawkins 2 жыл бұрын
Nailed it, however it is line 130. m_Grounded = true; // note: this was false when downloaded from Brackeys.
@IanAnimatesBagels
@IanAnimatesBagels 3 жыл бұрын
GUYS! If you're jump animation isn't working: (starting for a split second before you leave the ground) you don't need to add any ridiculous code. you don't need to modify the character controller. All you need to do is go to both of the exit transitions from the jump animation and turn ON the "Has Exit Time" parameter.
@IanAnimatesBagels
@IanAnimatesBagels 3 жыл бұрын
(and also make sure your ground check is outside of your bottom collider)
@omegachonker9987
@omegachonker9987 3 жыл бұрын
thanks this really saved me from insanity xd
@omegachonker9987
@omegachonker9987 3 жыл бұрын
however you do have to set the jump animation to exactly the time you spend jumping otherwise you either end the animation in mid air and it looks really weird if you make it to short and if you make it too long then you end up on the floor looking like your falling anyone got a workaround?
@IanAnimatesBagels
@IanAnimatesBagels 3 жыл бұрын
@@harshitpal4996 do you have it set to play in the animator controller and have the animation triggered by script like in the video?
@shanujoshi1937
@shanujoshi1937 3 жыл бұрын
Thanks!! you saved me :)
@somieuler-ajayi5246
@somieuler-ajayi5246 2 жыл бұрын
Problem: If you can't find the sample rate select the three buttons in the top right corner of the animation tab and select show sample rate
@Artemisi_
@Artemisi_ 2 жыл бұрын
Thank you so much
@premasoupl4150
@premasoupl4150 2 жыл бұрын
thank youuu
@XiTrOnEexe
@XiTrOnEexe 2 жыл бұрын
thank you buddy
@mrpooptheiii3444
@mrpooptheiii3444 2 жыл бұрын
thx
@vayn5726
@vayn5726 2 жыл бұрын
you saved me thanks
@CarboAter
@CarboAter 11 ай бұрын
My man left KZbin years ago, still the best tutor out there. Thanks for all you have done Brackeys:)
@adriking5383
@adriking5383 4 жыл бұрын
Animations Sample doesnt exist for me :/ Edit: I found If you click on the 3 dots on the right of the animation tab you can select "Show Sample rate"
@Tortuex_
@Tortuex_ 3 жыл бұрын
thank you so much couldn't figure it out
@florentbacale3280
@florentbacale3280 3 жыл бұрын
@@Tortuex_ How did you do it ? I can't seem to find it, the three dots only propose to close tab or add another for me
@Tortuex_
@Tortuex_ 3 жыл бұрын
@@florentbacale3280 it's the three dots right under those, it needs to be on the animation panel and not the "global" panel :) try and find three dots below the ones you found ;)
@stunity1767
@stunity1767 3 жыл бұрын
Thank you so much, this really helped!
@anishsrivatsan2332
@anishsrivatsan2332 3 жыл бұрын
Thanks a lot! I couldnt find it either, but your comment helped :)
@ZickyNee
@ZickyNee 3 жыл бұрын
once again brackeys has the simplest and most effective solution - we miss you boss!
@jood7449
@jood7449 3 жыл бұрын
hey man youre like the most recent comment on here and im having trouble with the events component under the character controller script, i cant find a solution to it and a i was wondering if you knew
@thebigduckproduction9044
@thebigduckproduction9044 3 жыл бұрын
Yea true
@elranstorm197
@elranstorm197 2 жыл бұрын
most effective - kill me
@SHLFBEATS
@SHLFBEATS 2 жыл бұрын
@@jood7449 if i were you id join the discord if you haven’t. Theres a bunch of smart ppl that will help.
@ArquimedesOfficial
@ArquimedesOfficial 2 жыл бұрын
its a nice tutorial, but using physics for 2d collisions is not efficient, physics is very expensive...you should use tiled based collisions instead...
@xavierturcotte7777
@xavierturcotte7777 2 жыл бұрын
For those who had an error where Idle and Crouch animation are playing at the same time, when you click the player, at the top of the inspector you should see where it is written "Layer". By default the Layer is set to Default, so what you should do is add a new Layer called "player", set the player's layer to that new layer, and finally uncheck the layer at the "what is ground" in the character controller.
@AneksKuchenny
@AneksKuchenny 2 жыл бұрын
Thanks a lot, you rescued me
@NakedSageAstrology
@NakedSageAstrology 2 жыл бұрын
Thank you for the tip, but mine still seems to be trying to activate both without pressing anything...
@onionhead8399
@onionhead8399 2 жыл бұрын
i don't know if you still alive but you saved me after hour of suffering
@luckythedev2361
@luckythedev2361 Жыл бұрын
when i click on "what is ground" they dont show me uncheck option how i uncheck player layer?
@quimmich
@quimmich Жыл бұрын
what a champ
@jarvis911
@jarvis911 5 жыл бұрын
I just started getting into C# and game making in Unity again after hitting a brick wall and quitting a couple of years ago but your videos are really helping me grasp C# and Unity much more than I did before, thanks man I appreciate it!
@OGMoltac
@OGMoltac 3 жыл бұрын
I would be lost without Brackeys, thank you for everything you have done
@Officergizmo
@Officergizmo 3 жыл бұрын
If you would only have known
@uzidayo
@uzidayo 3 жыл бұрын
@@Officergizmo lol
@magiclessbrat8501
@magiclessbrat8501 3 жыл бұрын
Please tell me how you add character controler
@AugustasWeb
@AugustasWeb Жыл бұрын
@@magiclessbrat8501 its complicated
@autismclips5076
@autismclips5076 Жыл бұрын
All of your Unity tutorials are absolutely amazing, they've been helping me so much in learning game development! Keep up the great work!
@th3-wolf130
@th3-wolf130 4 жыл бұрын
I love these tutorials, they are the only reason i know how to do remotely anything in UNITY
@kronos2107
@kronos2107 3 жыл бұрын
Thy master shall be remembered thanks for the experience brackeys 4 months of you gone is like a decade to me
@bguilleminot
@bguilleminot 3 жыл бұрын
If anyone is having trouble with the jump animation, check that your ground's layer is set to "ground". Mine was in "default" layer and as soon I changed it to ground everything started working. Do what Dante says too: "find the ground radius variable [in character controller 2d script] and change it to a lower number like .05" Hope this helps
@totallyrandompersob1664
@totallyrandompersob1664 3 жыл бұрын
If the jumping animation doesn't work still, maybe try keeping on exit time for when it switches to idle or running. Don't keep Transition time. Only keep it for when it goes from Any State->Jumping. Turn off exit time too on Any State->Jumping. I hope it helps because it worked for me. Not the perfect solution, but it works. I know I'm coping and pasting on everything EDIT: don't do it it causes a weird glitch if you keep pressing the jump button in midair.
@Arel_Kursat
@Arel_Kursat 2 жыл бұрын
my character more like a meatball (the free unity asset with that red ball like character) and the slopes was not triggering the grounded bool in character controller. Normal terrain was fine even without any layering. Adding layer didn't worked so I went ahead and edit the character controller to add a second ground check and placed it both to each edges of the character and it worked wonderfully.
@dominicbermea9828
@dominicbermea9828 2 жыл бұрын
I couldn't figure out the first one, but the ground radius variable worked!
@i_28_tesla
@i_28_tesla 3 жыл бұрын
thank you so much brackeys! your 2d tutorials are just what i need! thank you so much for uploading these or i would have been gone crazy if i were to do it myself or with another video. Thank you for helping me making my own first 2D platformer by the art of uploading videos.
@ralphcalzada4767
@ralphcalzada4767 Жыл бұрын
i miss this channel
@amritsahani69420
@amritsahani69420 Жыл бұрын
sameee😭😭
@vasil-yt
@vasil-yt 5 жыл бұрын
Skeletal animation would be so helpful and it looks quicker too
@NotBanned_
@NotBanned_ 5 жыл бұрын
It is less quality, of course.
@crob3545
@crob3545 5 жыл бұрын
Not Enough Horror. It seems it would be good for a 2D physics based fighting game like the one Im gunna try make
@Issung123
@Issung123 5 жыл бұрын
Both have their pros and cons, you cannot get a pixel style like in this video with skeletal animation
@Mrabet_Houssem
@Mrabet_Houssem 5 жыл бұрын
actually you can , look for Dead Cells
@cocobos
@cocobos 5 жыл бұрын
sprite swap is the best for pixelarts though.
@INAVACL
@INAVACL 4 жыл бұрын
This is exactly the video I needed! I made different art pieces for animating in unity and wasn't sure how to go about it.
@77chickennug84
@77chickennug84 Жыл бұрын
For those struggling with jumping animation playing for only one frame: 1. Go to somewhere around Line 127 2. Change "m_Grounded = false" to "m_Grounded = true" If you're having trouble finding this line, it should be after the following if statement: "if (m_Grounded && Jump)"
@duyne7128
@duyne7128 Жыл бұрын
Bro, TYSM you saved my life
@lovfall642
@lovfall642 Жыл бұрын
Thank you so much!
@mannycalavera121
@mannycalavera121 Жыл бұрын
Thanks mate, this is what i was looking for
@sil3ntsoldier236
@sil3ntsoldier236 Жыл бұрын
THANK YOU. U R A LEGEND 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
@ziadhassan7
@ziadhassan7 Жыл бұрын
And you also need to check off (can transition to self ) on the transition from anyState
@wafflewarriorthe3rd
@wafflewarriorthe3rd 5 жыл бұрын
Thank you so much, this is saving me during my platform design final.
@henryjohn6244
@henryjohn6244 5 жыл бұрын
finally, after the error are occurrence. I can make animation for my character. Thank you so much Brackey.
@IvanBoychuk
@IvanBoychuk 2 жыл бұрын
Incredibly easy and clear! Definitely you are the best tutorial channel about Unity!
@evewhoo
@evewhoo 5 жыл бұрын
This was a lifesaver! Thank you so much! Everything was explained very clearly.
@licensetothrill
@licensetothrill 5 жыл бұрын
In case he doesn't mention it in the video, there's a reason that sprite sheets and atlases were developed and are still used in games today. They greatly save on memory and runtime because only a single instance of the sprite array image is loaded into memory at once, and all draws simply render a specific sub-section of the same file pointer in memory. In Unity, you can see this in action with the batching stats. This is an important concept in any engine, however. Including ones like Unreal or Love2D or Godot or Lumberyard. It's an important concept regardless of the engine, language or technology.
@guymen8
@guymen8 4 жыл бұрын
Thanks for being so patient 😊😁! It's a fantastic tutorial and the previous two were also awesome! That's a great series!
@GrenadierPete
@GrenadierPete 3 жыл бұрын
I should have found this video at the start of the weekend! Great job explaining transitions! It all makes sense to me now! And yes, skeletal animation would be interesting to learn!
@robertharbison4199
@robertharbison4199 5 жыл бұрын
Your tutorials are so helpful. I would love to see a skeletal animation one! Thanks for your hard work.
@Spartaton
@Spartaton 5 жыл бұрын
I think covering skeletal animation is a great idea. Perhaps consider looking at the new skeletal 2D animation being integrated into Unity rather than or in addition to Anima 2D.
@jonatan01i
@jonatan01i 5 жыл бұрын
@Bobby5z0 you bastard xd
@FreakofNature147
@FreakofNature147 3 жыл бұрын
I seriously love what you do. Thank you for everything!
@isaacwilkerson4057
@isaacwilkerson4057 3 жыл бұрын
im using my own script and was wondering if anyone knows how to add the events to my character controller
@leopoldo1586
@leopoldo1586 5 жыл бұрын
I would LOVE a video on anima 2d
@abdoudjam6846
@abdoudjam6846 5 жыл бұрын
Thanks a Lot ! yes Please skeletal animation would be so helpful ! ( Like if you agree ) !
@thenicksterd2334
@thenicksterd2334 5 жыл бұрын
?
@Relaxing137
@Relaxing137 5 жыл бұрын
yeah,,..,. ?
@darkbruhify509
@darkbruhify509 4 жыл бұрын
Sans
@xteensgames
@xteensgames 4 жыл бұрын
Cristian the great toast because sans
@kandy5129
@kandy5129 4 жыл бұрын
@Cristian the great toast he has to do with everything
@joshlikesmusic8619
@joshlikesmusic8619 3 жыл бұрын
In my game the "Crouch" animation made me hover, so I edited the Character Controller a lil so it removes 2 colliders. Now it's Smooooth. Loved the vid, long time coder, first time unity user. Definitely a thumbs up!
@tylerstyle307
@tylerstyle307 4 жыл бұрын
2D animation is easier than I thought it would be! Thanks Brakeys!
@MCcoffa
@MCcoffa 4 жыл бұрын
you.are.the.best... literally saving my school semester XD
@monkeyrobotsinc.9875
@monkeyrobotsinc.9875 3 жыл бұрын
Lol, you, lol school
@danybeam
@danybeam 4 жыл бұрын
IDK if anyone will see this comment But if your OnLanding is being called too soon and you don't want to change your jump force for whatever reason, try moving your ground check a little more to the center and actually a little higher than you would expect to be the "right" Y position. I set mine a little higher than what seemed correct (was right on the feet moved somewhere at shin level) and it worked perfectly
@ramadesara
@ramadesara 11 ай бұрын
Thank you so much!
@the_glow_board1
@the_glow_board1 10 ай бұрын
I saw it... in 2023
@salesman4396
@salesman4396 4 жыл бұрын
Your teaching style is amazing ! God Bless
@SHAHSAMINYASAR
@SHAHSAMINYASAR 3 жыл бұрын
The great thing is that you keep your *smile* _visible>true_ in all your videos...keep going!
@watagree
@watagree 5 жыл бұрын
Hey i really like your content. I don’t know anything about coding and stuff. And I don’t watch your videos to learn but simply because I enjoy them. Game development is so intriguing and it looks really cool. I hope I get a change to actually learn from your videos when I finally get the time. ALSO ARE YOU GUYS FULL TIME KZbinRS OR ARE YOU AN INDIE STUDIO. I ask this because I would really like to see a fully fleshed out game of yours!!!!!!!
@scrub4749
@scrub4749 5 жыл бұрын
Hey, im having a problem where while jumping my animation switches from jumping to idle animation mid jump. I would set up some kind of velocity parameter but i dont know how
@theemeraldfalcon9184
@theemeraldfalcon9184 5 жыл бұрын
it needs to loop i've checked mine but the animation doesn't loop do you know why?
@Dedglitch
@Dedglitch 2 жыл бұрын
the only tutorial that actuallly helped me even 2021
@SamAlexandros
@SamAlexandros Жыл бұрын
Lifesaver! It takes me a lot to time to animate through code!
@eziothegoat
@eziothegoat 5 жыл бұрын
Please do game saving/loading tutorial!!
@AhmedKhalfYolo
@AhmedKhalfYolo 5 жыл бұрын
Just use player prefs
@AhmedKhalfYolo
@AhmedKhalfYolo 5 жыл бұрын
He made a video about saving and loading high score
@eziothegoat
@eziothegoat 5 жыл бұрын
I mean about saving and loading if you exit the game and you want to continue playing later ..
@AhmedKhalfYolo
@AhmedKhalfYolo 5 жыл бұрын
Yea same technique
@ererbe
@ererbe 5 жыл бұрын
or you can use save game free (it is very helpful in my eyes)
@thekiwisedge3498
@thekiwisedge3498 5 жыл бұрын
When I have the Character Controller 2D script open the events show, and I can’t access them. What should I do?
@isroelchernetskey
@isroelchernetskey 4 жыл бұрын
in this Prohect New Script
@nicholascarson2554
@nicholascarson2554 4 жыл бұрын
You want to press the plus sign and then drag your player movement script inside of your event.
@gk1460
@gk1460 3 жыл бұрын
how do i add events?
@jood7449
@jood7449 3 жыл бұрын
i am having the same issue now
@jood7449
@jood7449 3 жыл бұрын
but i cant see any events at all under the script
@user-gn7zo1bz5w
@user-gn7zo1bz5w 4 жыл бұрын
This is exactly what I wanted. thank u!!
@arkadiuszmazurek8898
@arkadiuszmazurek8898 2 жыл бұрын
Bro, I just watched carefully your tutorial and my game has +1 level, thank you :)
@ceciliacecchet5869
@ceciliacecchet5869 Жыл бұрын
If the samples aren't showing up in your unity animation tab, press the three points that are on the corner of the tab (the animation tab) and press "show sample rate"
@benevolent9130
@benevolent9130 2 жыл бұрын
For everyone that's struggling with an error where Idle and Crouch animation are playing at the same time to the Character Controller SCRIPT line 67 or 69 there is a ! before crouch. I struggled hours
@matildemonaexe
@matildemonaexe 2 жыл бұрын
omfg thank you!
@sophiali220
@sophiali220 2 жыл бұрын
Oh my gosh this literally saved my sanity!!! Thanks for the tip
@rama585
@rama585 2 жыл бұрын
woahh thank you!
@xavierturcotte7777
@xavierturcotte7777 2 жыл бұрын
I had the same problem and I tried to erase the ! at line 67 , but that made the player uncrouch when stop pressing the crouch button even if there is a ceiling. What I did to solve the problem was to add a new Layer(not sorting layer) called player, put the player in that layer and finally disabling the player layer in the "what is ground" in the character controller.
@xigniter7785
@xigniter7785 2 жыл бұрын
thanks a lot you are a saviour!
@MintyBunnyJuniper
@MintyBunnyJuniper Жыл бұрын
I appreciate you for keeping your channels on view so that we can see other good channels for this too thank you 😭
@omeryilmaz1021
@omeryilmaz1021 4 жыл бұрын
one of the best tutorials thanks!
@chrismeier3923
@chrismeier3923 5 жыл бұрын
I am finding that all of my character movements and animations work perfectly, but the jump animation doesn't activate unless my character is already off the ground. I tried moving my ground check up a bit, but it just looks like the jump animation flickers and then stops. While I am in the air, if I hit the jump button again, the animation works. Any suggestions?
@Hylian_SK
@Hylian_SK 2 жыл бұрын
@animeharmonics Thank You!!!
@greatmy1050
@greatmy1050 2 жыл бұрын
Yo same
@greatmy1050
@greatmy1050 2 жыл бұрын
@animeharmonics It didn't work for me
@deano1
@deano1 3 жыл бұрын
The problem - everything. The soloution - cry
@thananjaijongrak7604
@thananjaijongrak7604 3 жыл бұрын
20 mins for Brackeys to do jumping animation. It took me 2 whole hours to solve all the problems. bool meCrying = true;
@kacpercicharski4193
@kacpercicharski4193 3 жыл бұрын
And i have no idea how to play cutscenes. Cry==1 If Cry == 1: Print("big sad')
@azzazz430
@azzazz430 3 жыл бұрын
@@kacpercicharski4193 brackets also has a vid on that
@azzazz430
@azzazz430 3 жыл бұрын
Brackeys**
@azzazz430
@azzazz430 3 жыл бұрын
@@kacpercicharski4193 also the syntax in that is preeeetty wrong 😬
@lurky5913
@lurky5913 4 жыл бұрын
So amazing,you are truly a genius
@gefest9530
@gefest9530 4 жыл бұрын
The best tutrorial, it's great!
@evancarson5301
@evancarson5301 5 жыл бұрын
I need learn more coding and this is a great vid
@zaadshadow1279
@zaadshadow1279 5 жыл бұрын
he made a C# series. you should watch it
@meersindi3800
@meersindi3800 4 жыл бұрын
jack you*
@imconfused6955
@imconfused6955 5 жыл бұрын
Your On Land event is checking too soon and that's causing my character to stop jumping immediately after leaving the ground. Any idea on why this is happening and how I can fix it?
@alizlatan4331
@alizlatan4331 5 жыл бұрын
I'm Confused same
@teda-t6757
@teda-t6757 5 жыл бұрын
Same here.. :/
@teda-t6757
@teda-t6757 5 жыл бұрын
I have found a solution that works for me - it may be the same reason for you. I needed to increase the Jump Force and it worked fine. I think it's because when the force is too low, the play doesn't leave the ground quick enough before the On Land event is called to ground it.
@alizlatan4331
@alizlatan4331 5 жыл бұрын
Ted Alden-Templeman it didnt work (And do you know why the idle animation & crouching animation play both at the same time)?
@d3athstalker
@d3athstalker 5 жыл бұрын
Did you find an answer to this? The problem roots from the Character Controller 2D script but as of now I can't find a way to stop it from checking so fast EDIT: I actually just implemented something to delay this check from happening so quickly. This is the first thing that came to mind so it might not be the best option but you can download my edited script here : drive.google.com/file/d/1AMkNgVx0mRJHY9Jsiv_r5ifnYBuo7D94/view?usp=sharing I added a delay time variable which can be modified in the Unity Inspector under the Character Controller 2D script. If you use this script instead of the one supplied in the GIT repo it should work for you as well.
@kapcioszek2137
@kapcioszek2137 Жыл бұрын
Your tutorial really helped me out! Thank you a lot
@rubabmubarrat
@rubabmubarrat Жыл бұрын
one of my favourite videos!
@frannypack8879
@frannypack8879 5 жыл бұрын
Hey Brackeys, been following your tutorials so far and I'm learning a lot through it. I'm currently trying to figure out melee attacks and how to script it. I noticed you didn't have a melee combat tutorial video for 2d games, would you be willing to make one?
@r3ady150
@r3ady150 4 жыл бұрын
For those who are not seeing the samples option. Maximize the animation window and you should see 2 pairs of 3 dots in top right corner. Select the bottom most one and select show samples. I spent about an hour finding out how to do that one thing. SMH @ unity
@claidei0011
@claidei0011 2 жыл бұрын
Thanks! I almost quit after I couldn't find it
@henrytai4030
@henrytai4030 2 жыл бұрын
I love you so much
@franceandson
@franceandson 2 жыл бұрын
This tutorial was great! Thank you!
@georgecobb1466
@georgecobb1466 3 жыл бұрын
Thanks so much for this. I was stuck but this really helped!
@suryamdg
@suryamdg 2 жыл бұрын
For those of you who only see the Jump Animation for a split second this simple solution might work: *Solution:* Decrease the ground check radius and check if it works properly (if it still doesn't work decrease it even more). This also might not work if you have kept the game object that checks if touching ground too much below the player. *Explanation:* The reason why this is not working is that the program is checking for ground at that very split second of the jump since the program is updating too fast the animation check option keeps returning to false. If you decrease the radius of the ground check then by the time the program checks for ground the overlapping circle would have moved away from the ground due to low radius thus not overlapping anymore. *Don't add Exit time I know it works but the problem with that is it only works for fully flat ground, suppose you are jumping to a level higher than you then the sprite would be touching ground before the exit time is over thus remaining in jump animation for more time in spite of touching ground*
@fanaticape295
@fanaticape295 8 ай бұрын
Thank you, this helped a lot!
@zonevaldez9716
@zonevaldez9716 5 жыл бұрын
please help me! Why i need to double press the UP/W key to see the animation of jumping?
@sheadex4786
@sheadex4786 5 жыл бұрын
Same for me :(
@Kardiiacc
@Kardiiacc 5 жыл бұрын
me to
@ethanevans2402
@ethanevans2402 5 жыл бұрын
I think it has something to do with his character controller script. If you look at the FixedUpdate function in his character controller he invokes the on land event whenever the character’s ground check intersects the ground and when the character was falling before that. The problem is that when your character jumps there is a split second where after you’ve jumped, the character’s ground check is still touching the ground, which means the character controller thinks you were just falling and just landed. This is why you can see the animation for a split second before it goes back to idle. Once you’re up in the air and press it again the animation plays because the ground check is far enough away from the ground to not trigger the event. Working on a solution right now.
@provensi
@provensi 5 жыл бұрын
here guys private void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.gameObject.layer == 9) { OnLandEvent.Invoke(); } } delete where the another OnLandEvent.Invoke() is (FixedUpdate() i think), in my case the ground layer is 9, so change it if not yours
@danielselaru7247
@danielselaru7247 5 жыл бұрын
Well, I did this and it's kind of working :)) if (Input.GetButtonDown("Jump")) { jump = true; animator.SetBool("IsJumping", true); }else if (Input.GetButtonUp("Jump")) { jump = true; }
@cecibenitez3917
@cecibenitez3917 2 жыл бұрын
omg!! thanks Bucky the ".anim" extension was missing in my case, thanks!!
@JC-rv2tq
@JC-rv2tq 3 жыл бұрын
IDK if u are reading this but uve been helping a lot with my College work all year long THANKSS
@alextashkov2772
@alextashkov2772 4 жыл бұрын
Ok i know im late but for those of you reading this and having the bug with the jumping animation failing to transition to the idle or running animation - i think i found a fix (atleast it fixed mine) SO 1 - find the line if(!wasGrounded) in the script that they provided and change it to if(!wasGrounded && m_Rigidbody2D.velocity.y
@yojojo351
@yojojo351 4 жыл бұрын
Thank you
@miguelreliquias4407
@miguelreliquias4407 4 жыл бұрын
thanks bro!
@mustafaalnaeb1651
@mustafaalnaeb1651 3 жыл бұрын
Thank you so much life saver!
@zaichothepsychoofficial7208
@zaichothepsychoofficial7208 2 жыл бұрын
FOR JUMPING, If you have an animation that is more than one frame long and animation is stuck on first frame do this Click on the transition from ANY STATE to JUMPING --->Untick 'Can Transition To'. this was causing an infinite loop allowing the animation to loop into restarting, staying in the first frame
@yuno833
@yuno833 Жыл бұрын
Thank you so much
@learnunity8487
@learnunity8487 4 жыл бұрын
hey I have been watching some of your videos and it's very helpful thanks man
@cisnerosjerez
@cisnerosjerez 2 жыл бұрын
Brackeys you are the man!
@pastaloverohyeah
@pastaloverohyeah 2 жыл бұрын
If your jump animation keeps looping, go to your jump->idle transition and change the parameter to "Speed Less Than .01" :)
@Sh4dxw20
@Sh4dxw20 7 ай бұрын
Didn't work 😭
@PoppyTheDrapica
@PoppyTheDrapica 5 жыл бұрын
I'm crying my character is walking and moving and ahsjdkgashjfgfj THANK YOU
@aminecraftsalmon1645
@aminecraftsalmon1645 2 жыл бұрын
This guy really helps.
@starlightakabane4686
@starlightakabane4686 2 жыл бұрын
Thank you so much I actually made a dumb mistake of not finishing the video so I missed all the script parts and had a lot of trouble with it like for a day and then I went back and saw that we had to script and I was literally mindblown bruh. IT WAS SO BAD 😭😭😭 But luckily I finished the video this time and got my animations!!!! TYSM!!!!!
@Xeratas
@Xeratas 5 жыл бұрын
so there is a bug, when you jump and land and for some reason your movementspeed is exactly 0.1 he will stuck in the jump animation.
@middlemarv
@middlemarv 5 жыл бұрын
Thank you so much. You sent me down the right road. I was having this exact problem but I had it set to greater than 0.01. Set it to Lesser no longer a problem. Cheers.
@pantheon4141
@pantheon4141 5 жыл бұрын
Thanks a lot! you saved me a lot of trouble! \(*o*)/
@yuratwitch1093
@yuratwitch1093 5 жыл бұрын
@@middlemarv Can u tell me how to do this?
@middlemarv
@middlemarv 5 жыл бұрын
@@yuratwitch1093 I can and will. Give me 20 mins.
@middlemarv
@middlemarv 5 жыл бұрын
@@yuratwitch1093 So I am going over this again as well. I lost my last build and I don't think this works as well with the newer version because I'm having difficulty with my player jumping without animation let alone with the animation. Basically though go to 5:10 he talks about how you can create two animations for the jump up and down. I think that may fix the problem however how you do that I'm not sure yet. Continuing with how Brackey is doing it. Go to 6:15 where he explains the animator than jump to 7:48 where he goes over parameters then to 1216 where he explains how to set up the transition of going to jump anytime. The time stamp 13:38 and I believe this is what I was talking about a month ago when it transitions back to the idle animation make sure jumping equals false and that the speed is less than 0.01. I hope this helps. Just curious to what version you are using. If you don't mind.
@devmelonroblox
@devmelonroblox 3 жыл бұрын
my jump animation plays for like 0.0001 seconds because it touches the ground when i jump how do i fix this?
@xiejames5549
@xiejames5549 Жыл бұрын
Animation super cool! Thank your sharing ~
@yeevon3852
@yeevon3852 4 жыл бұрын
A very good video in teaching. This helps me alot in my journey
@Ravik-no6wx
@Ravik-no6wx 5 жыл бұрын
woah nice tut, Im just curious - r u usin' some extension to color ur code or u customize all of it in the vs?
@maroc7697
@maroc7697 5 жыл бұрын
I code in vs and (in default) it seems like in video, maybe you have to update it :)
@mauriciocortespersonal
@mauriciocortespersonal 4 жыл бұрын
is there a way to reuse the same animations (walk, jump, etc) with other sprites automatically? (to change player skins without creating all the animations again) i found a way but it must be a better way.... My way is hard to explain but is like this: - create an empty gameobject ("Player"?) with all the individual sprites in the same position x,y,z - use generic names for the sprites (frame1, frame2, frame3 or idle01, idle02, jump01) - in the animation you want to create (let's say: "Jump") you record and set the parameter Gameobject.isActive to false on all the sprites except the one you need to that keyframe (and repeat) - Done. If you want to create a different "Skin", just duplicate the previous gameobject ("Player") and change the sprites (using the inspector) without changing the names of the gameobjects containing the sprites. - All the animations and animator-controllers can be used with this new skin automatically! if you have 30 animations, you wont need to create 30 more for every skin, just duplicate the first skin and replace the sprites and you're ready! Note: i found there's another way (kzbin.info/www/bejne/fn6UaKB3orGXbc0), replacing the 2D texture in the lateUpdate, the tutorial is from 2014 i haven't test it yet
@PritamDavis
@PritamDavis 3 жыл бұрын
the way you told is pretty impressive, and considering a player wouldnt have more than 30 images, 30 gameobjects also does not put load on the cpu, and also, no gameobjects are created or destroyed, just enabled and disabled... Yeah so ur solution is pretty cool
@PritamDavis
@PritamDavis 3 жыл бұрын
Cant think of a better way
@thananjaijongrak7604
@thananjaijongrak7604 3 жыл бұрын
I just install Unity and learn C# for like 2 months. So I wonder will my guess be usable? instead of duplicating 30 animators, can we apply with code? like create a pool of library and call the sprite that we actually need for player.
@windwakin
@windwakin 2 жыл бұрын
Use an animator override controller my dude. I use it to copy animation transitions without all the extra work because I can just drag and drop the animations and sprites I wanna use in and PRESTO!
@soop6015
@soop6015 4 жыл бұрын
Awesome vid! Rlly helpful comment section too
@dgm778
@dgm778 8 ай бұрын
BROOOOOOOOOOOOOOOOOOO!! JUST WHAT I NEED IT!!!!
@user-hf4bn9ii9l
@user-hf4bn9ii9l 4 жыл бұрын
when playing the Moving animation of my player, the animation is playing and everything is okay, but it plays UNDER the player image meaning that the deafualt art is over the animation. The weird thing is that my idle animtion plays just fine, it is a blinking animation and thus I know for sure that it actually overwrites the current player model. Any idea why it's happening?
@MagnetiumWoop
@MagnetiumWoop 4 жыл бұрын
It happend to me too
@CiaranChan
@CiaranChan 4 жыл бұрын
Have you tried setting your character to a specific Character Sorting layer, and then putting that in front of your background? Try removing all your other assets by hitting the little eye symbol on their left and see if it still blinks. If not, it was a sorting issue.
@user-eo5hv
@user-eo5hv 4 жыл бұрын
There's no 'Player' getting created, so I can't use the player as the controller in the animator component. PLS HELP
@ethanrogers2056
@ethanrogers2056 3 жыл бұрын
little late but...Do you mean the animator controler? press "+" at the top of the assets window and add "animator controler."
@monkeyrobotsinc.9875
@monkeyrobotsinc.9875 3 жыл бұрын
Epic content. I've been hard at work. It's kewl.
@ashurgeltv
@ashurgeltv 3 жыл бұрын
SUPER AWESOME!!! I don't know why everyone is complaining. Everything in this video works fine and I'm making this game in 10/20 using the spaceman animation. All codes and everything else works fine. Honestly you just have to be patient and be able to problem solve. I feel people give up on themselves very easy. Trust me...I spent over 7 hours alone trying to get his crouch animation to work. i erased and rewrote the code...I went back and rewatched the video plenty of times...I am happy to say that yesterday i figured out the problems and I couldn't be more happier. It was a super easy fix which honestly pissed me off. As soon as i got it to all work. I saved the game and closed it. Thanks for everything and I plan to watch most of your vids.
@gmbalacera6086
@gmbalacera6086 5 жыл бұрын
i love it, just recently bought the aseprite and im willing to make my own videogame, these videos are a lot of help! ♥
@TheEpicplushgod
@TheEpicplushgod 2 жыл бұрын
I am unsure why but when I do this for my own sprites for my game when I press play in the animation window it does not change the sprites at all, does anybody know why this is happening or a way to fix this? If so that would be very helpful!
@Victor-kt6qn
@Victor-kt6qn 4 жыл бұрын
Someone help!!! My jump animation only plays the fall animation at the peak of the jump. Before the peak it displays the idle animation also after the peak it plays the idle animation.... Help. It looks like my character is having a spasm
@j.kkidding9764
@j.kkidding9764 4 жыл бұрын
oh boy.. thats really hard man. I hope you find a solution to it!
@erin2150
@erin2150 3 жыл бұрын
Love the videos, thank you!
@totallyrandompersob1664
@totallyrandompersob1664 3 жыл бұрын
If the jumping animation doesn't work still, maybe try keeping on exit time for when it switches to idle or running. Don't keep Transition time. Only keep it for when it goes from Any State->Jumping. Turn off exit time too on Any State->Jumping. I hope it helps because it worked for me. Not the perfect solution, but it works. EDIT: don't do it it causes a weird glitch if you keep pressing the jump button in midair.
@TheLastApplePie
@TheLastApplePie 5 жыл бұрын
How do you add "Events" on a Script? i didn't use his Character Controller 2D script
@Petesails
@Petesails 3 жыл бұрын
I'm assuming you've got this now but for anyone else struggling at the top put - using UnityEngine.Events; then an attribute that says this - [SerializeField] UnityEvent OnLandEvent; then where you want to trigger the event - OnLandEvent.Invoke(); I managed to get the last 2 lines but i couldn't work out where i was going wrong for ages turns out you need to tell is to use the events thing at the top. That is really important aparently.
@deepseaking1506
@deepseaking1506 2 жыл бұрын
@@Petesails thank you thank you THANK YOU
@SuperMrMuster
@SuperMrMuster 5 жыл бұрын
How do you change your sprites facing? I've been going back and forth in your video, but I can't find the part where you tell Unity to mirror the sprite if the character is moving left. For you, it just seems to work right out of the box. I wrote my movement script before watching this video, so I don't know if you have it somewhere in there.
@jonathanzhu6917
@jonathanzhu6917 Жыл бұрын
In the character controller, he uses a method called flip to flip the character depending on the direction its facing (it uses the horizontal input from the user, ie -1 is facing left, 1 is facing right)
@FordivenX
@FordivenX 3 ай бұрын
brackeys is the goat
@TB3hnz
@TB3hnz 4 жыл бұрын
NAILED IT!!!
@joyousgaming4935
@joyousgaming4935 3 жыл бұрын
"simply click and drag that into the animation." ME: clicks and drags *doesnt do anything* watches more video cant play the animation is more confused there is nothing simple about this
@muhammadmohsen8732
@muhammadmohsen8732 3 жыл бұрын
check this video out it might help you : kzbin.info/www/bejne/i3OUlnargpemnKc
@edwardcox7169
@edwardcox7169 3 жыл бұрын
unity is stupid. the gameobject you created the animator for HAS TO BE SELECTED to drag sprites into the animator.
@blackphant8399
@blackphant8399 2 жыл бұрын
@@muhammadmohsen8732 No its not help... its same
@jadonmullinex9389
@jadonmullinex9389 2 жыл бұрын
You need to select the object that you want to animate. If you want to animate an object named "Player", click on player in the Heirarchy or scene.
@Demigodish4o3
@Demigodish4o3 5 жыл бұрын
For some reason the idle transitions to crouching animation without me pressing anything. The "isCrouching" Parameter keeps going On and Off automatically :(
@BerlandMedia
@BerlandMedia 5 жыл бұрын
I have the same problem.. Did you find a fix for it?
@oooriuken
@oooriuken 5 жыл бұрын
Check if your player has the "Player" layer assigned
@BerlandMedia
@BerlandMedia 5 жыл бұрын
Worked for me! Thank you :D
@oooriuken
@oooriuken 5 жыл бұрын
Also the attribute “What Is Ground” of “Character Controller 2D” need to have everything selected except for that “Player” layer
@harperhejter7766
@harperhejter7766 5 жыл бұрын
I have the same issue. Player is on a player layer , tilemap is on a default layer and "what is ground" have everything selected except for Player layer
@realastormin
@realastormin 3 жыл бұрын
YOU RE MY HERO THANKS!
@Tarzy8
@Tarzy8 4 жыл бұрын
Te do el love , u r awesome , u r savin my university proyect
@michaelbariotakis2315
@michaelbariotakis2315 5 жыл бұрын
Great video! Could you explain how you added the Events (the OnJump and the OnCrouch)?
@kink1728
@kink1728 5 жыл бұрын
Did you figure it out?
@anastasiiababoian8531
@anastasiiababoian8531 4 жыл бұрын
@@kink1728 noooo , plese help
@Naz-uh6dg
@Naz-uh6dg 3 жыл бұрын
Did i late?? kzbin.info/www/bejne/mqjGhWB6mM1jmKM That one is the tutorial
@loydamaraluen8966
@loydamaraluen8966 Жыл бұрын
4 years later and I'm wondering the same :(
2D Camera in Unity (Cinemachine Tutorial)
9:19
Brackeys
Рет қаралды 768 М.
2D Movement in Unity (Tutorial)
21:09
Brackeys
Рет қаралды 3 МЛН
ELE QUEBROU A TAÇA DE FUTEBOL
00:45
Matheus Kriwat
Рет қаралды 36 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 80 МЛН
小女孩把路人当成离世的妈妈,太感人了.#short #angel #clown
00:53
The Ultimate Pixel Art Tutorial
14:15
Saultoons
Рет қаралды 1,4 МЛН
How I designed Fruit Ninja
22:58
Luke Muscat
Рет қаралды 6 МЛН
3 Hours vs. 3 Years of Blender
17:44
Isto Inc.
Рет қаралды 3,5 МЛН
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 3,8 МЛН
HOW TO MAKE 2D GAME ANIMATIONS IN UNITY - BEGINNER TUTORIAL
14:58
Blackthornprod
Рет қаралды 580 М.
Code Class - 2D Player Movement in Unity
29:02
AdamCYounis
Рет қаралды 25 М.
Hand drawn is easier than pixel art | HD graphics vs low-bit vs Hi-bit
10:00
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
ELE QUEBROU A TAÇA DE FUTEBOL
00:45
Matheus Kriwat
Рет қаралды 36 МЛН