using UnityEngine; using System.Collections;
public class Gui : MonoBehaviour {
public string str;
public Texture imageTexture;
private int screenWidth;
private int screenHeight; // Use this for initialization void Start () { screenWidth = Screen.width; screenHeight = Screen.height; } // Update is called once per frame void Update () { }
void OnGUI() { GUI.Label (new Rect (100, 10, 100, 30), str); GUI.Label (new Rect (100, 40, 100, 30), "当前屏幕宽"+screenWidth); GUI.Label (new Rect (100, 80, 100, 30), "当前屏幕高"+screenHeight); } }
using UnityEngine;
using System.Collections; public class Gui : MonoBehaviour { public string str; public Texture imageTexture; private int screenWidth; private int screenHeight;
// Use this for initialization
void Start () {
screenWidth = Screen.width;
screenHeight = Screen.height;
} // Update is called once per frame
void Update () { } void OnGUI()
{
GUI.Label (new Rect (, , , ), str);
GUI.Label (new Rect (, , , ), "当前屏幕宽"+screenWidth);
GUI.Label (new Rect (, , , ), "当前屏幕高"+screenHeight);
}
}