using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
string str;
Texture imageTexture;
private int imageWidth;
private int imageHeight;
private int screenWidth;
private int screenHeight;
// Use this for initialization
void Start () {
screenWidth=Screen.width;
screenHeight=Screen.height;
imageWidth=imageTexture.width;
imageHeight=imageTexture.height;
}
// Update is called once per frame
void OnGUI () {
UnityEngine.GUI.Label(new Rect(100,10,100,30),str);
UnityEngine.GUI.Label(new Rect(100,40,100,30),"当前屏幕宽:{0}",screenWidth);
UnityEngine.GUI.Label(new Rect(100,80,100,30),"当前屏幕高:{0}",screenHeight);
UnityEngine.GUI.Label(new Rect(100,120,0,0),imageWidth,imageHeight,imageTexture);
}
}
错误提示Assets/NewBehaviourScript.cs(22,33): error CS1502: The best overloaded method match for `UnityEngine.GUI.Label(UnityEngine.Rect, string, UnityEngine.GUIStyle)' has some invalid arguments
Assets/NewBehaviourScript.cs(22,33): error CS1503: Argument `#3' cannot convert `int' expression to type `UnityEngine.GUIStyle'
Assets/NewBehaviourScript.cs(23,33): error CS1502: The best overloaded method match for `UnityEngine.GUI.Label(UnityEngine.Rect, string, UnityEngine.GUIStyle)' has some invalid arguments
Assets/NewBehaviourScript.cs(23,33): error CS1503: Argument `#3' cannot convert `int' expression to type `UnityEngine.GUIStyle'
Assets/NewBehaviourScript.cs(24,33): error CS1501: No overload for method `Label' takes `4' arguments
static function Label()这个在java和c#是一样的吗?
你能不能在我的基础上帮我改改