I was trying to change the sprite image of my character from another scene. I made two scripts
- Sprite_Img.js
- 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