我在Unity(CSharp)中有这样的代码:
public GameObject button;
public GameObject panel;
void Start () {
button.transform.SetParent (panel.transform);
Sprite shape = Resources.Load<Sprite>("Logo");
var img = button.transform.GetComponent("Image") as Image;
img.sprite = shape;
img.color = new Color (50, 50, 50, 50);
}
现在,这就是我的场景在Play之前的样子:
然后,当我按下播放按钮时,我得到了这个:
I can see in the inspector that the sprite was successfuly loaded
有人可以告诉我有关此行为的任何线索吗?
答案 0 :(得分:0)
嗯,好像你分配精灵的方式不正确。精灵通过UPDATE users SET username=:username ,password=:password WHERE username='term'
分配。你可以试试这个,
Sprite.Create