My Health Script Won't work in C#

I’m trying to convert my Javascript to C# but it won’t work.

Javascript:

var backgroundTexture : Texture; //input image lftTop4
var foregroundTexture : Texture; //input image lftTop2
var foregroundTexture2 : Texture; //input image lftTop3
var frameTexture : Texture; //input image lftTop1
 
var healthWidth: int = 52;
var healthHeight: int = 234;
 
var healthMarginLeft: int = 41;
var healthMarginTop: int = -76;
 
 var manaWidth: int = 81;
var manaHeight: int = 160;
 
var manaMarginLeft: int = 25;
var manaMarginTop: int = -39;
 
var frameWidth : int = 195;
var frameHeight: int = 195;
 
var frameMarginLeft : int = -14;
var frameMarginTop: int = -39;
 
function OnGUI () {
 
    GUI.DrawTexture( Rect(frameMarginLeft,frameMarginTop, frameMarginLeft + frameWidth, frameMarginTop + frameHeight), backgroundTexture, ScaleMode.ScaleToFit, true, 0 );
 
    GUI.DrawTexture( Rect(healthMarginLeft,healthMarginTop,healthWidth + healthMarginLeft, healthHeight), foregroundTexture, ScaleMode.ScaleAndCrop, true, 0 );
 
 GUI.DrawTexture( Rect(manaMarginLeft,manaMarginTop,manaWidth + manaMarginLeft, manaHeight), foregroundTexture2, ScaleMode.ScaleAndCrop, true, 0 );
 
    GUI.DrawTexture( Rect(frameMarginLeft,frameMarginTop, frameMarginLeft + frameWidth,frameMarginTop + frameHeight), frameTexture, ScaleMode.ScaleToFit, true, 0 );
 
}

Attempt at C# convert:

using UnityEngine;
using System.Collections;

public class MYCLASSNAME : MonoBehaviour {
Texture backgroundTexture; //input image lftTop4
Texture foregroundTexture; //input image lftTop2
Texture foregroundTexture2; //input image lftTop3
Texture frameTexture; //input image lftTop1
 
int healthWidth = 52;
int healthHeight = 234;
 
int healthMarginLeft = 41;
int healthMarginTop = -76;
 
 int manaWidth = 81;
int manaHeight = 160;
 
int manaMarginLeft = 25;
int manaMarginTop = -39;
 
int frameWidth = 195;
int frameHeight = 195;
 
int frameMarginLeft = -14;
int frameMarginTop = -39;
 
void  OnGUI (){
 
    GUI.DrawTexture( new Rect(frameMarginLeft,frameMarginTop, frameMarginLeft + frameWidth, frameMarginTop + frameHeight), backgroundTexture, ScaleMode.ScaleToFit, true, 0 );
 
    GUI.DrawTexture( new Rect(healthMarginLeft,healthMarginTop,healthWidth + healthMarginLeft, healthHeight), foregroundTexture, ScaleMode.ScaleAndCrop, true, 0 );
 
 GUI.DrawTexture( new Rect(manaMarginLeft,manaMarginTop,manaWidth + manaMarginLeft, manaHeight), foregroundTexture2, ScaleMode.ScaleAndCrop, true, 0 );
 
    GUI.DrawTexture( new Rect(frameMarginLeft,frameMarginTop, frameMarginLeft + frameWidth,frameMarginTop + frameHeight), frameTexture, ScaleMode.ScaleToFit, true, 0 );
 
}
}

You don’t say how “it won’t work.” The only thing I see wrong is that instance variables are public by default and private by default in C#. So in theory you should have ‘public’ in front of all of your variables. In practice, I believe all the ‘int’ variables should be private, so the only change is:

public Texture backgroundTexture; //input image lftTop4
public Texture foregroundTexture; //input image lftTop2
public Texture foregroundTexture2; //input image lftTop3
public Texture frameTexture; //input image lftTop1

I assume these get initialized by drag and drop in the Inspector.