Resources are lost after building

Hello,
I have code that works fine in the editor, but after compiling all the textures added from the code is lost.
Can I do something wrong?

public class Sprite123 : MonoBehaviour {
    
        SpriteRenderer newSprite;
        Texture2D texture;
        string[] str = new string[] { "Assets/Image/icon-bi60x60.jpg", "Assets/Image/2.jpg", "Assets/1.png" };
        int i = 0;
        
    
        void Start()
        {
           newSprite = GetComponent<SpriteRenderer>();        
        }
    
        public GUIStyle customButton;
        void OnGUI()
        {
            GUI.Box(new Rect(10, 10, 100, 90), "Loader Menu");
            
            if (GUI.Button(new Rect(20, 40, 80, 20), "Add"))
            {
                newSprite.sprite = SpriteRenderer.Instantiate(newSprite.sprite)as Sprite;
    
                texture = (Texture2D)Resources.LoadAssetAtPath(str*, typeof(Texture2D));* 

newSprite.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f,0.5f));

newSprite.sprite.name = texture.name;
i++;
if (i == str.Length)
{
i = 0;
}
}
}
}

“All assets that are in a folder named “Resources” anywhere in the Assets folder can be accessed via the Resources.Load functions. Multiple “Resources” folders may exist and when loading objects each will be examined.”

Hi

as mentioned in the previous answer, firstly you need to place your resources in a Resources folder.

Secondly, LoadAssetAtPath only works in the editor, it will not work when the game is compiled.

You will need to create a Folder names “Resources” in the root of your assets foler, then use the following code to load your resource

texture = Resources.Load<Texture2D>(str*);* 

or
texture = Resources.Load(str*, typeof(Texture2D))*
_*http://docs.unity3d.com/ScriptReference/Resources.Load.html*_