localScale Changes the scale form the center and not the left

Hey everyone! So, I’m currently making a game and I’m at the part of adding a health bar to my character. Everything works! When an enemy hit me, I lose health! the only problem is that when ever I lose health the bar scales down to the middle and not from one end to the other like a normal health bar!

Here’s the code that handle the scale of my health bar

    /// <summary>
    /// Mets à jour les divers éléments qui représente la vie du joueur.
    /// </summary>
    private void MettreAJourBarreVie()
    {
        // Normalise les points de vie.
        m_pointsVieNormalise = 1f * m_pointsVie / m_maxPointsVie;

        // Ajuste la barre selon les points de vie normalisés.
        m_barreVie.localScale = new Vector3(m_pointsVieNormalise, 1f, 1f);
        // Remplace le texte avec la nouvelle valeur.
        m_texteVie.text = $"{m_pointsVie} Go libres sur {m_maxPointsVie} Go";
    }

hello.

IS the bar a canvas image? or is a object in scene?

If its a image in canvas, you only need to change its pivot in its RectTrasnform component.

If its a object, you should make the bar child of an emptyobject, and this emptyobject will act as pivot, so must be places at the corner of the bar.

Bye!