原文地址:http://weibo.com/819881121?from=myfollow_all&is_all=1#_rnd1455674673856
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class GameViewTest : MonoBehaviour
{
private float lastwidth = 0f;
private float lastheight = 0f;
private void OnGUI()
{
if (lastwidth != Screen.width || lastheight != Screen.height)
{
lastwidth = Screen.width;
lastheight = Screen.height;
print("Resolution :" + Screen.width + " X" + Screen.height);
}
}
}