为什么将一个场景中的GUI.skin纹理设置为整个场景的默认值

时间:2015-06-18 13:01:07

标签: c# unity3d

以下是发生的事情:

在场景一中:

void OnGUI() {
   string _text = "Options";
   GUIContent content = new GUIContent ();
   content.image = (Texture2D)imageForTexture; 
    content.text = _text;
        GUI.skin.button.normal.background = (Texture2D)content.image;
        GUI.skin.button.hover.background = (Texture2D)content.image;
        GUI.skin.button.active.background = (Texture2D)content.image;

        GUIStyle myButtonStyle = new GUIStyle(GUI.skin.button);
        myButtonStyle.fontSize = 20;

        myButtonStyle.normal.textColor = Color.green;

GUI.Button(new Rect(Screen.width/2-700, Screen.height/2 -200     ,300,100),content,myButtonStyle);

}

在场景二中:

void OnGUI()
 {
  GUI.Button(new Rect(Screen.width/2-700, Screen.height/2 -200 ,300,100),"Instruction");

 }

这里的按钮是什么样的:

enter image description here

enter image description here

您的经验始终是支持性的。提前谢谢!

0 个答案:

没有答案