UIAtlas myAtlas = new UIAtlas();
Texture2D myTexture = Resources.Load("Sprites/mySprite"); myAtlas.AddSprite("mySprite", myTexture);
Image myImage = GetComponent(); myImage.sprite = myAtlas.GetSprite("mySprite");This gets the Image component attached to the game object, and sets its sprite to the "mySprite" sprite from the UIAtlas. UIAtlas is a built-in class in the Unity Engine, and does not require any additional package or library.