i want to scale a gui texture but...

im trying to make a health bar like heart
i have a heart image and i want to scale it according to hp/maxhp.
but when i use scalemode.scaleandcrop , it scales by two sides the image.
i need to scale the heart image by up to down.
this is my code ;

/// health 
var h_height = statusHP*150 / statusMaxHP;
if (h_height >0) var targetH = h_height; else targetH = 1;
GUI.DrawTexture(new Rect (150, 200, 150, 150), healthBar, ScaleMode.ScaleToFit);
GUI.DrawTexture(new Rect (150, 200, 150, targetH), healthImg, ScaleMode.ScaleAndCrop);
////

Hey Eren Aydn,

I would suggest using GUITexture.DrawTexture.
Something like this:

// Draws a texture in the left corner of the screen.
// The texture is drawn in a window 60x60 pixels.
// The source texture is given an aspect ratio of 10x1
// and scaled to fit in the 60x60 rectangle. Because
// the aspect ratio is preserved, the texture will fit
// inside a 60x10 pixel area of the screen rectangle.

var aTexture : Texture;

function OnGUI() {
if(!aTexture){
Debug.LogError("Assign a Texture in the inspector.");
return;
}
GUI.DrawTexture(Rect(10,10,60,60), aTexture, ScaleMode.ScaleToFit, true, 10.0f);
}

From The Unity Scripting Refrence

Why, don’t you make a texture with the “heart” full, then another at half, and other empty and then switch the textures? Isn’t it easier?