Animation End/Scene Change

Hello there, I have a quick question. How might I create a script in which when a certain animation ends, it loads a specific scene? This would be quiet helpful, thank you.

I have found a script on here, but I’ve no idea how to apply it. Here is the script:

    yield WaitForSeconds (animation.clip.length + 2);
    Application.LoadLevel ("Credits");

This code shows the basic idea: start an animation and use its length (duration) to generate a delay after which the new level is loaded. Let’s suppose that you want to start the “Death” animation and load the scene after that:

function PlayDeathAndLoadCredits(){
  animation.CrossFade("Death"); // smoothly start the Death animation
  yield WaitForSeconds(animation["Death"].length); // wait time enough
  Application.LoadLevel("Credits"); // animation finished: load Credits

Attach this code to the object script and call PlayDeathAndLoadCredits() when you want to do the magic.