rotate bones before bindposes

please a need help with this.

I have used this code http://unity3d.com/support/documentation/ScriptReference/Mesh-bindposes.html, modify but I noticed that the bones did not rotate. I've tried in this way to see the bones:

void Update(){ 

    try{
        for ( int i = 0; i < bones.Length; i++ ){
            Debug.DrawLine (bones_.transform.position,bones*.parent.transform.position, Color.green);*_
 _*}*_
 _*}catch(Exception e){}*_
_*}*_
_*```*_
_*<p>and this way to rorate:</p>*_
_*```*_
_*bones[1] = new GameObject("Upper").transform;*_
 _*bones[1].parent = transform;*_
 _*bones[1].localRotation = Quaternion.Euler(0,  180, 0);*_
 _*bones[1].localPosition = new Vector3(0, 5, 0);*_
_*```*_
_*<p>and does not work, the bones are not rotating.</p>*_
_*<p>What am I doing wrong?</p>*_
<em>*<p><img src="http://www.google.com.co/intl/en/images/logos/translate_logo.gif" alt="spanish to english">(spanish to english)</p>*</em>

Do you do this as well (taken from your link):

bindPoses[1] = bones[1].worldToLocalMatrix * transform.localToWorldMatrix;

This kind of "compensates" for the rotation that you just set. You need to change position/rotation of bone after that (better in runtime to see the results).

Do you really need to create meshes from code?

yes i do that the complete code is:

using UnityEngine;
using System.Collections;
using System;
public class example : MonoBehaviour {
    Transform[] bones;
    void Start() {
        gameObject.AddComponent<Animation>();
        gameObject.AddComponent<SkinnedMeshRenderer>();
        SkinnedMeshRenderer renderer = GetComponent<SkinnedMeshRenderer>();
        Mesh mesh = new Mesh();
        mesh.vertices = new Vector3[] {new Vector3(-1, 0, 0), new Vector3(1, 0, 0), new Vector3(-1, 5, 0), new Vector3(1, 5, 0)};
        mesh.uv = new Vector2[] {new Vector2(0, 0), new Vector2(1, 0), new Vector2(0, 1), new Vector2(1, 1)};
        mesh.triangles = new int[] {0, 1, 2, 1, 3, 2};
        mesh.RecalculateNormals();
        renderer.material = new Material(Shader.Find(" Diffuse"));
        BoneWeight[] weights = new BoneWeight[4];
        weights[0].boneIndex0 = 0;
        weights[0].weight0 = 1;
        weights[1].boneIndex0 = 0;
        weights[1].weight0 = 1;
        weights[2].boneIndex0 = 1;
        weights[2].weight0 = 1;
        weights[3].boneIndex0 = 1;
        weights[3].weight0 = 1;
        mesh.boneWeights = weights;
        bones = new Transform[2];
        Matrix4x4[] bindPoses = new Matrix4x4[2];
        bones[0] = new GameObject("Lower").transform;
        bones[0].parent = transform;
        bones[0].localRotation = Quaternion.identity;
        bones[0].localPosition = Vector3.zero;
        bindPoses[0] = bones[0].worldToLocalMatrix * transform.localToWorldMatrix;
        bones[1] = new GameObject("Upper").transform;
        bones[1].parent = transform;
        bones[1].localRotation = Quaternion.Euler(0,  180, 0);
        bones[1].localPosition = new Vector3(0, 5, 0);
        bindPoses[1] = bones[1].worldToLocalMatrix * transform.localToWorldMatrix;
        mesh.bindposes = bindPoses;
        renderer.bones = bones;
        renderer.sharedMesh = mesh;
        AnimationCurve curve = new AnimationCurve();
        curve.keys = new Keyframe[] {new Keyframe(0, 0, 0, 0), new Keyframe(1, 3, 0, 0), new Keyframe(2, 0.0F, 0, 0)};
        AnimationClip clip = new AnimationClip();
        clip.SetCurve("Lower", typeof(Transform), "m_LocalPosition.z", curve);
        animation.AddClip(clip, "test");
        animation.Play("test");
    }

    void Update(){ 

    try{
        for ( int i = 0; i < bones.Length; i++ ){
        Debug.DrawLine (bones_.transform.position,bones*.parent.transform.position, Color.green);*_
 _*}*_
 _*}catch(Exception e){}*_
 _*}*_
 _*}*_
_*```*_
_*<p>I see the inspector that applies a rotation, but graphically the object is in the same position and without rotating, try using that code and rotate in different angles, and you will see that they will always get the same result.*_
_*And yes, i need to create the mesh with code, becouse i'm allready reading a xml format, and greatly reducing the number of vertices when importing. </p>*_
_*<p>i need a rotation like this:</p>*_
_*<p><img src="http://img848.imageshack.us/img848/9495/dibujoni.jpg" alt="alt text"></p>*_
_*<p>please help me i really need this.</p>*_
_*<p>Greetings from Colombia!</p>*_