unity set sprite image from script code example
Example 1: load an image sprite script unity
void Start()
{
spriteArray = Resources.LoadAll<Sprite>("BirdHeroSprite");
}
Example 2: image.sprite unity
Image1.sprite =new Sprite;
Example 3: sprite unity script
Resources.Load <Sprite>
Example 4: unity set sprite image from script
Sprite myFruit = Resources.Load("fruits_1", typeof(Sprite)) as Sprite;