Unity_3D__GUI程序部分.docxVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Unity_3D__GUI程序部分

Unity 3D GUI程序部分作者:Evil1 按钮生成function OnGUI () {if (GUI.Button (Rect (10,10,150,100), I am a button)) {print (You clicked the button!);}}2 按钮场景载入/* Example level loader */function OnGUI () {// Make a background boxGUI.Box (Rect (10,10,100,90), Loader Menu);// Make the first button. If it is pressed, Application.Loadlevel (1) will be executedif (GUI.Button (Rect (20,40,80,20), Level 1)) {Application.LoadLevel (1);}// Make the second button.if (GUI.Button (Rect (20,70,80,20), Level 2)) {Application.LoadLevel (2);}}3 按钮点击生效时间/* Flashing button example */function OnGUI () {if (Time.time % 2 1) {if (GUI.Button (Rect (10,10,200,20), Meet the flashing button)) {print (You clicked me!);}}}4 创建按钮背景BOX/* Screen.width Screen.height example */function OnGUI () {GUI.Box (Rect (0,0,100,50), Top-left); //Rect 生成2D矩形的函数,用于摄像机,画面,GUIGUI.Box (Rect (Screen.width - 100,0,100,50), Top-right);GUI.Box (Rect (0,Screen.height - 50,100,50), Bottom-right);GUI.Box (Rect (Screen.width - 100,Screen.height - 50,100,50), Bottom-left);}5 在按钮上显示文字/* String Content example */function OnGUI () {GUI.Label (Rect (0,0,100,50), This is the text string for a Label Control); //显示文字}6 显示图像,声明一个公共变量的Texture2D,并通过这样的内容作为参数变量的名称/* Texture2D Content example */var controlTexture : Texture2D; //controlTexture为图像的名称function OnGUI () {GUI.Label (Rect (0,0,100,50), controlTexture);}7 显示图像的例子/* Button Content examples */var icon : Texture2D;function OnGUI () {if (GUI.Button (Rect (10,10, 100, 50), icon)) {print (you clicked the icon);}if (GUI.Button (Rect (10,70, 100, 20), This is text)) {print (you clicked the text button);}}8 显示在一个图形用户界面控制的图像和文字在一起。可以为内容提供一个参数GUIContent对象,并定义字符串和图像显示的是在GUIContent/* Using GUIContent to display an image and a string */var icon : Texture2D;function OnGUI () {GUI.Box (Rect (10,10,100,50), GUIContent(This is text, icon));}9 还可以定义在GUIContent工具提示,当他鼠标停留在按钮上时显示提示/* Using GUIContent to display a tooltip */function OnGUI () {// This line feeds This is t

文档评论(0)

me54545 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档