🎬 Unity Animator Tutorial | Replay Animations on Key Press | Unity Animation Play Function Explained
Welcome back to another Unity tutorial! 👋 In this video, we continue from our previous lesson where we played multiple animations (Run, Walk, Dance, Jump, Death, etc.) on specific keys like W, E, R, T, and Q 🎮.
In the last setup, we triggered animations using the Animator.Play() function directly by name. However, the issue was that once an animation (like Run) was already playing, pressing the same key again didn’t restart it — it just stayed idle at the end frame. 😩
In this tutorial, we fix that by learning how to replay any animation from the start every time the assigned key is pressed ✅. We explore the Animator.Play() function parameters — especially layer index and normalized time — and understand how giving a normalized time of 0.0f ensures the animation always starts fresh from the beginning 🕒.
💡 What You’ll Learn in This Video:
How to replay animations using Animator.Play()
Understanding normalized time and how it affects animation playback
How to make animations restart from the beginning on key press
Setting up multiple animation states (Idle, Run, Dance, Jump, Death)
Tips for safely saving and commenting scripts in Unity projects
Preparing for next tutorial: Using parameters inside the Animator window
By the end of this video, your Unity character will seamlessly replay any animation as many times as you want — perfect for creating dynamic, responsive gameplay! 🚀
👇 Don’t forget to LIKE 👍, SUBSCRIBE 🔔, and COMMENT 💬 your progress!
───────────────────────────────
🎥 Timestamps:
00:00 - Intro
00:06 - Recap of previous tutorial
01:00 - The issue with Play() not restarting animations
02:20 - Understanding Animator.Play parameters
03:00 - Using normalized time for replay control
04:30 - Testing the animation replay
06:00 - Copying and applying code for all animations
07:30 - Final testing and results
08:10 - What’s next: Animator parameters tutorial
───────────────────────────────
💻 Code Snippet Example:
animator.Play("Run", 0, 0.0f);
This ensures your “Run” animation plays from the start every time you press W.
───────────────────────────────
🔥 Tags for YouTube SEO:
unity animation tutorial, unity animator, unity animation play function, animator.play unity, unity replay animation, unity character animation, unity 3d tutorial, unity animation from start, unity normalized time, unity animator layer, unity beginner tutorial, unity scripting, unity animator parameters, unity learn, unity game development, unity animation coding, unity idle run jump animation, unity animation system, unity animation control, unity tutorial 2025
───────────────────────────────
🎮 Next Video:
In the next part, we’ll dive deep into Animator Parameters and learn how to use them to control transitions and link animations logically — making your projects even more interactive and professional! 🧩
#Unity #Animator #GameDev #Unity3D #UnityAnimation #UnityTutorial #Coding #GameDevelopment #LearnUnity
Информация по комментариям в разработке