Dbutton.js

Jmnote (토론 | 기여)님의 2013년 9월 28일 (토) 14:18 판 (→‎예제 코드)
유니티 동적 버튼 생성

1 예제 코드

@script ExecuteInEditMode()

var x:float = 10;
var y:float = 10;
var width:float = 300;
var height:float = 120;
var text = "Hello";
var skin:GUISkin = null;

function OnGUI () {
	var rX = Screen.width / General.stdWidth;
	var rY = Screen.height / General.stdHeight;
	var rXY = (rX<rY)? rX: rY;
	GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3(rX, rY, 1));
	GUI.skin = skin;
	if (GUI.Button(Rect(x, y, width, height), text)) {
		Debug.Log("Clicked");
	}
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}