#pragma strict

var str:String;
//接收外部复制贴图
var imageTexture:Texture;
private var imageWidth:int;
private var imageHeight:int;
private var screenWidth:int;
private var screenHeight:int;

function Start () {

	//得到屏幕宽高
	screenWidth=Screen.width;
	screenHeight=Screen.height;
	
	//得到图片宽高
	imageWidth=imageTexture.width;
	imageHeight=imageTexture.height;
}

function Update () {

}

function OnGUI()
{
	//见文字内容显示在屏幕中
	GUI.Label(Rect(100,10,100,30),str);
	GUI.Label(Rect(100,40,400,30),"当前屏幕宽:"+screenWidth);
	GUI.Label(Rect(100,80,100,30),"当前屏幕高:"+screenHeight);
	
	GUI.Label(Rect(100,120,imageWidth,imageHeight),imageTexture);

}

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2021-05-29
猜你喜欢
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-06-11
  • 2021-07-09
  • 2022-12-23
相关资源
相似解决方案