下载此文档

Unity3D常用脚本.doc


文档分类:IT计算机 | 页数:约15页 举报非法文档有奖
1/15
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/15 下载此文档
文档列表 文档介绍
场景转换:varscreenbutton:boolean;functionStart(){DontDestroyOnLoad(this); screenbutton=true;}functionUpdate(){if(()){ screenbutton=true; }}functionOnGUI(){if(screenbutton==true)if((Rect(-380,-190,60,50),"Scene1")){ print("YouclickScene1"); (1); screenbutton=false; }elseif((Rect(-380,-130,60,50),"Scene2")){ print("YouclickScene2"); (2); screenbutton=false; }elseif((Rect(-375,-0,50,50),"Quit")){ print("YouclickQuit"); (); }} 心得:场景转换时,这个程序贴在按钮界面场景中。在BuildSetting(导出)(在File下)菜单中加入所需场景。0为按钮界面。可以无限增加场景。 }elseif((Rect(-380,-130,60,50),"Scene2")){ print("YouclickScene2"); (2); screenbutton=false;复制此段程序并做修改。运动控制键:上下左右varTankSpeed:int=20;functionUpdate(){if(()){ print("go"); (**TankSpeed); }elseif(()){ print("goback"); (**-TankSpeed); }elseif(()){ print("turnleft"); (**-TankSpeed); }elseif(()){ print("turnright"); (**TankSpeed); }}需要放在第一视角的物体或者摄像机上。加天空背景:ponent下的Rendering下的Skybox。将他加在所需场景的摄像机上,选择所需的天空。运行时自然出现。各种按钮汇总:鼠标碰触后显示说明文字。functionOnGUI(){(Rect(0,0,100,20),GUIContent("Clickme","Thisisthetooltip"));(Rect(0,40,100,40),); }多项选择,以上都选择。varallOptions=true;varextended1=true;varextended2=true;functionOnGUI(){allOptions=(Rect(0,120,150,20),allOptions,"EditAllOptions");=allOptions;extended1=(Rect(20,70,130,20),extended1,"ExtendedOption1");extended2=(Rect(20,90,130,20),extended2,"ExtendedOption2");=true;if((Rect(0,160,150,20),"Ok"));print("userclickedok");}鼠标碰触第一个按钮有解释,鼠标碰触第三个对话框有解

Unity3D常用脚本 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数15
  • 收藏数0 收藏
  • 顶次数0
  • 上传人我是开始
  • 文件大小2.80 MB
  • 时间2020-05-18