i want to change image of button when clicked, so doing it with following code.
it works fine with unity simulator, but when loaded it on iPhone, iPad, image is not getting changed.
1st click image disappear, 2nd click default image gets visible ... and goes on, but it is not changing the image.
public void sound_toggle()
{
Debug.Log ("Sound");
if (sound_status)
{
gameObject.GetComponent<UI2DSprite> ().sprite2D = Resources.LoadAssetAtPath<Sprite> ("Assets/Mainscreen/Images/sound_off.png");
sound_status = false;
}
else
{
gameObject.GetComponent<UI2DSprite> ().sprite2D = Resources.LoadAssetAtPath<Sprite> ("Assets/Mainscreen/Images/sound_on.png");
sound_status = true;
}
}