Комментарии:
How much does int hashing improve performance? Lets say we have a robust system for the player so animations for jumping, falling, transitioning, sliding, walk/running, wall running , etc. As your example is, with pixel art specifically. How do you know when int hashing is worth the time investment?
ОтветитьWait... you can just do that????? So I've spent who knows how long checking and rechecking dozens of transitions, adding, removing and moving around bools and triggers when i could have just told it to play the animation and got it working perfectly in 30 seconds??????
ОтветитьFinally found a channel with 0 BS, straight to the point, non-trivial dev advice.
Thank you!
Thank you for sharing this
ОтветитьThanks a lot. Does it work with multiple layers ?
ОтветитьNo way this guy is reading 700 comments
ОтветитьDope. Now I can wipe that spiderweb out of my animator. Thanks!
ОтветитьThank you for this video.
ОтветитьYou can go a step further and just write your own animation classes. I do it a lot with Images under the Canvas, and I've been thinking of creating a more robust AnimationManager that maintains a list of different animation types that all derive from an abstract base class. Here's a one-off example using a normal Unity C# class/script. The intended usage is to have an object of another class holding a reference to an instance of this class which is attached to a gameObject that also has an image component. That other object uses the reference to set the gameObject holding this animator script active/inactive. This specific design is intended for an object that is always animated when visible.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FlameAnimator : MonoBehaviour
{
private List<Sprite> sprites = new List<Sprite>();
private Image flameImage;
private bool playAnimation;
private static readonly float spriteChangeInterval = 0.07f;
private void Awake()
{
this.sprites.Add(Resources.Load<Sprite>("Flame0"));
this.sprites.Add(Resources.Load<Sprite>("Flame1"));
this.sprites.Add(Resources.Load<Sprite>("Flame2"));
this.sprites.Add(Resources.Load<Sprite>("Flame3"));
this.sprites.Add(Resources.Load<Sprite>("Flame4"));
this.sprites.Add(Resources.Load<Sprite>("Flame5"));
this.sprites.Add(Resources.Load<Sprite>("Flame6"));
this.sprites.Add(Resources.Load<Sprite>("Flame7"));
this.sprites.Add(Resources.Load<Sprite>("Flame8"));
this.flameImage = this.gameObject.GetComponent<Image>();
this.playAnimation = false;
}
private void OnEnable()
{
this.playAnimation = true;
StartCoroutine(AnimationCoroutine());
}
private void OnDisable()
{
this.playAnimation = false;
StopCoroutine(AnimationCoroutine());
this.flameImage.sprite = sprites[0];
}
private IEnumerator AnimationCoroutine()
{
while(this.playAnimation)
{
for (int i = 0; i < sprites.Count; i++)
{
this.flameImage.sprite = this.sprites[i];
yield return new WaitForSeconds(spriteChangeInterval);
}
for (int i = sprites.Count - 1; i >= 0; i--)
{
this.flameImage.sprite = sprites[i];
yield return new WaitForSeconds(spriteChangeInterval);
}
}
}
}
Keep the good vids, amazing!
Ответить😀
Ответить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 :)
Ответить"That's how you animate like a programmer"
as a programmer, I would say you are seriously gimping yourself animating like this. If you animate this way you missing out on all types of blending, layering and state control. Plus, also as a programmer I greatly appreciate separating animation out of of my code.
Organizing your animation states and using substates, layers, and blendtress will prevent any spiderweb issues once you gain the proper experience.
Didn't expect that 2 minutes video could be so useful.. You are genius, thanks!🙂
ОтветитьVery useful, I'm gonna try this method, but for a 3D game.
Just a tiiiiny criticism, because I see this done in so many pieces of code: why try to shorten the var names so much that they become confusing? For instance, "private Animator _anim;". That should be "private Animator animator;", "anim" is confusing since it could also be an Animation. I see things like that done so much, and I wish people named their vars better.
How did u get "bool _landed' variable?
Ответитьanimation on Unity does suck, but this approach only works for indie devs I guess, it would be the worst idea to have your entire animation on code on a big project, designers have no way to change anything without code changes, and even if you offer an interface for this via inspector it would still be bad, if all you have are developers on the team and a small project mostly maintained by you then I guess this is a viable approach if you like programming, apart from that, not really a practical approach in the end. but good to know about its existence anyways
Ответитьmy animator sometimes gives really long error starts with graps awake .. how can ı fix it? it is fixed when ı restart unity but ı have restart per 30 or 15 minute
ОтветитьHonestly, as a programmer, i could deal with the giant frustration of networking and animation. With enough trial and error, things will work!
But for the life of me, i can't make a simple UI that looks pretty.. i just dont understand art 😕 🤷♂️
Holy shit, is this video really only 2 minutes long? It felt much longer, and I mean that in a good way. A lot of information presented very concisely and intelligently. Thank you.
ОтветитьOMG I thought I was the only one triggered by the lines not being straight in the animator
Ответить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
Ответитьthis channel is a blessing ..honestly. superb content.
Ответитьthanks you're amazing
ОтветитьI'm trying to get out of the Animator window and go this route. Though I'm having a hard time comprehending it, it makes my head hurt.
ОтветитьI've tried animancer but it doesn't work with mirror networking, sad
ОтветитьWell, I've been working on the graphics for a few years now. I'm going to have to get serious about the controls.
Have you ever generated your graphics via scripts?
That's what I'm doing. They're all 3D meshes. Kind of like SVGs would have been, created dynamically in Flash.
This tip is so simple yet so effective. It just pulled me out of a full half-day unity animator nightmare. Thanks Tarodev 💙
ОтветитьI have a question. How do you set the bools back to false? For example, I'm using when you press the "Attack Button", '_attacking; is set to true. At which point does it become false again? Are you using AnimEvents?
Ответитьim stuck at the animator for setting the animation settings and code help!
(walk,idle,run,attack,hurt,die,jump(random jump animations)dash....)
Animating like a programmer > programming like an animator.
ОтветитьCan you pleaseeeee make a detailed video about animating using scripts
ОтветитьI'm relieved that I'm not alone to align horizontally the animator connection lines :D
Ответить😭 the line… you just touched my heart. That line drove me insane for so long. I hate it.
Ответитьsometimes.... i despise Unity for having multiple ways of doing animation....
lv 1 use animator in the simplest form...
lv 2 use blend tree and sub state and avatar and overide...
lv 3 use animator behaviour component...
lv 4 use int hash + crossfade...
lv 5 use custom finite state machine pattern...
lv 6 use animation rig for procedural animations...
lv ? use animancer pro...
Great job as always! by the way thanks to you that you made me understand i have OCD
ОтветитьCan someone help me how did he use mirrored sprites for negative x
Ответитьyou read EVERY SINGLE comment eh? .... prove it!
ОтветитьFor people like me that use their own state machine this video is priceless.
ОтветитьThank you. You just answered a question of mine. I was trying to find out how you apply a crossfade on an animation on a different layer. didnt realize it was one of the variables you just have to pass in.
Assuming you mean something like in the case of avatar masks where in my case I want to make the hands have a different blend tree to the feet using avatar masks to separate the animations
Taking you up on that last bit and informing you that I like pineapple on pizza.
ОтветитьHow did you progress in unity? I’m at a point where I’m not sure which direction to progress as I’m still a beginner
Ответитьthis is absolutely awesome did not know about this, thanks !
ОтветитьI’m rewriting all this in ts 😭
ОтветитьSir your tutorials are absolutely amazing for beginner devs like me. Sir, just one request your tutorials are very paced. Please go slow. Also I have seen most of your videos. I would request you to make a tutorial for games to run on Android mobiles, their optimization and all the necessary stuffs. You are a life saver indeed!!!
ОтветитьThis is top tier stuff! Wow! Thanks for this bite sized powerhouse! 💪🏿🦾
Ответитьplayed your intro at 100% volume and it made my cat jump on my chest and it hurted
??
How did you get the line to appear behind the character when moving him?
Ответить