Mecanim state change question

Is it possible to set a mecanim animation state through script? For example, I would like my character dying animation available to all other states without having to manually create a transition between all of them.

Yes you can change states by script.
Use CrossFade(string stateName, float transitionDuration).
Here is a simplified C# example.

    Animator anim = GetComponent<Animator>();

    if(Input.GetKeyUp(KeyCode.W))
      anim.CrossFade("WalkUp", 0f)

    else if(Input.GetKey(KeyCode.S))
      anim.CrossFade("WalkDown", 0f);

Be aware that this bypasses transitions.
Use it wisely and it can be very helpful.,

As far as I know, there isn’t a way to change the state by script yet.

For the dying animation, you can add this as a transition from the “Any State”:
http://d.pr/i/v4sX

Any State is a special state which is always present. It exists for the situation where you want to go to a specific state regardless of which state you are currently in.