I have a code like this in Unity (CSharp):
public GameObject button;
public GameObject panel;
void Start () {
button.transform.SetParent (panel.transform);
Sprite shape = Resources.Load(“Logo”);
var img = button.transform.GetComponent(“Image”) as Image;
img.sprite = shape;
img.color = new Color (50, 50, 50, 50);
}
Now, this is how my scene looks before Play:
Then, when I press the Play Button I get this:
I can see in the inspector that the sprite was successfuly loaded
Can somebody give me any clue about this behavior?