Sprite SpriteModding(string path)
{
byte[] bytes = File.ReadAllBytes(Application.dataPath + "/Resources/fgsoftwarestudio.png");
Texture2D texture = new Texture2D(512, 512, TextureFormat.RGB24, false);
texture.filterMode = FilterMode.Trilinear;
texture.LoadImage(bytes);
Sprite sprite = Sprite.Create(texture, new Rect(0, 0, 512, 512), new Vector2(0.5f, 0.0f), 1.0f);
sprite_bg.GetComponent<SpriteRenderer>().sprite = sprite;
return null;
}
i open game and sprite don't render
If you are loading a file from resources folder try Resources.Load
more information here: Information about Resources folder