unity ui sprite image code example
Example 1: image.sprite unity
Image1.sprite =new Sprite;
Example 2: unity set sprite image from script
Sprite myFruit = Resources.Load("fruits_1", typeof(Sprite)) as Sprite;
Image1.sprite =new Sprite;
Sprite myFruit = Resources.Load("fruits_1", typeof(Sprite)) as Sprite;