Making my variable global.

I was trying to change the sprite image of my character from another scene. I made two scripts

  1. Sprite_Img.js
  2. changeTheSprite.js

I have attached Sprite_Img.js to my character object and changeTheSprite,js to a image

But still it isn’t working well. I dont know why.
Please Help

Sprite_Img.js

#pragma strict

var sprite2:Sprite;
static public var sprite1:Sprite;



function Awake(){
sprite2 = sprite1;
}

function Start (){
GetComponent(SpriteRenderer).sprite = sprite2;
}

changeTheSprite.js

#pragma strict

var sprite3 : Sprite;
function Start() {
 if (Input.GetMouseButton(1)){       
     Sprite_Img.sprite1 = sprite3;
     }
}

THANK YOU

keep a reference to the spriterenderer instead of the sprite . this way, the change will work.