title: How to loop part of an animation in Unity
body: <p>What is the best solution to <strong>loop only a part of an animation</strong> in Unity ?</p>
  
  <p>The best I can find is <a href="https://docs.unity3d.com/ScriptReference/Animation.CrossFade.html" rel="nofollow">Animation CrossFade</a> , so if I have a 3 min animation and I want to loop only during 0:30 and 1:00, <em>the code is</em> :</p>
  
  <pre><code>void Start() {
          anim = GetComponent&lt;Animation&gt;();
  }
  void Foo() {
          anim["Take_01"].time = 30.0;
          anim.CrossFade("Take_01",30.0, PlayMode.StopSameLayer);
  }
  </code></pre>