Hi. Iam working on system, where button can change sprite render object. So i maked 2 scripts, first-
#pragma strict
publicvar sprajt:Sprite;
functionUpdate(){
GetComponent(SpriteRenderer).sprite = sprajt;
}
This script is in gameobject. Second-
#pragma strict
publicvar sprajtTWO :Sprite;
function change (){
GetComponent(objectSCRIPT).sprajt = sprajtTWO;
}
that is in button fucntion OnClick… i want when someone pressbutton sprite render will change… so there is problem, error “Object reference not set to an instance of an object”… any solution / ideas how to make sprite render changer?