Unity3D Keynote

 1、场景文件扩展名为.unity。

 2、up为Y正方向,down为Y负方向,right为X正方向,left为X负方向,forward为Z正方向,back为z负方向。基础物体本身坐标系。

 3、在Scene工具条中可以设置Scene视图绘制模式:

  

 4、给一个GameObject添加RigidBody,即可实现碰撞效果。

 5、按以下代码添加GUI:

 //模型移动速度
var TranslateSpeed = 20;
//模型旋转速度
var RotateSpeed = 1000;
//游戏绘制UI
function OnGUI()
{
//设置GUI背景颜色
GUI.backgroundColor = Color.red; //按钮点击旋转、平移事件
if(GUI.Button(Rect(10,10,70,30), "向左旋转")){
transform.Rotate(Vector3.up *Time.deltaTime * -RotateSpeed);
} if(GUI.Button(Rect(90,10,70,30), "向前移动")){
transform.Translate(Vector3.forward * Time.deltaTime *TranslateSpeed); } if(GUI.Button(Rect(170,10,70,30), "向右旋转")){
transform.Rotate(Vector3.up *Time.deltaTime * RotateSpeed);
} if(GUI.Button(Rect(90,50,70,30), "向后移动")){
transform.Translate(Vector3.forward * Time.deltaTime * -TranslateSpeed);
} if(GUI.Button(Rect(10,50,70,30), "向左移动")){
transform.Translate(Vector3.right * Time.deltaTime *-TranslateSpeed);
} if(GUI.Button(Rect(170,50,70,30), "向右移动")){
transform.Translate(Vector3.right * Time.deltaTime * TranslateSpeed);
} //将旋转平移的系数显示在屏幕中
GUI.Label(Rect(250, 10,200,30),"模型的位置" +transform.position); GUI.Label(Rect(250, 50,200,30),"模型的旋转" +transform.rotation);
}

6、所有GameObject都可以添加GUI,均显示在屏幕上。不同GameObject添加的GUI如果位置重叠可能会相互覆盖。

 7、Control appearances are dictated with GUIStyles. When you have a large number of different GUIStyles to work with, you can define them all within a single GUISkin. A GUISkin is no more than a collection of GUIStyles.  

 8、使用GUISkin

 // JavaScript
var mySkin : GUISkin; function OnGUI () {
// Assign the skin to be the one currently used.
GUI.skin = mySkin; // Make a button. This will get the default "button" style from the skin assigned to mySkin.
GUI.Button (Rect (10,10,150,20), "Skinned Button");
}

9、In Fixed Layout, you can put different Controls into Groups. In Automatic Layout, you can put different Controls into AreasHorizontal Groups, and Vertical Groups。Notice that inside an Area, Controls with visible elements like Buttons and Boxes will stretch their width to the full length of the Area.

 10、Unity 2.0 introduced UnityGUI, a GUI Scripting system. You may prefer creating user interface elements with UnityGUI instead of GUI Texts.

  GUI Text是老技术,Unity官方建议优先使用UnityGUI。

 11、A GUI Layer Component is attached to a Camera to enable rendering of 2D GUIs.

  When a GUI Layer is attached to a Camera it will render all GUI Textures and GUI Texts in the scene. GUI Layers do not affect UnityGUI in any way.

  GUI Layer跟GUI Textures, GUI Texts有关,跟UnityGUI的显示无关,是一项老技术,官方建议淘汰。

12、Text Meshes can be used for rendering road signs, graffiti etc. The Text Mesh places text in the 3D scene. To make generic 2D text for GUIs, use a GUI Textcomponent instead.

 13、通过对象的 .renderer.material.mainTexture 可以修改GameObject的对象的贴图,以此可以实现动画。

14、Unity脚本生命周期:

 15、prefab就是一个存储在磁盘上的GameObject。

Unity3D Keynote的更多相关文章

  1. Unity3D Script Keynote

    [Unity3D Script Keynote] 1.创建GameObject if(GUILayout.Button("创建立方体",GUILayout.Height(50))) ...

  2. Unity3D Physics Keynote

    [Unity3D Physics Keynote] 1.在哪设置Layer Collision Matrix? "Edit"->"Project Settings& ...

  3. 杂项:Unity3D

    ylbtech-杂项:Unity3D Unity3D是由Unity Technologies开发的一个让玩家轻松创建诸如三维视频游戏.建筑可视化.实时三维动画等类型互动内容的多平台的综合型游戏开发工具 ...

  4. NavMesh KeyNote

    [NavMesh KeyNote] 1.NavMesh.CalculatePath(srcPos, desPos) 若srcPos,desPos相等,则CalculatePath返回false. 2. ...

  5. Unity3d学习 预设体(prefab)的一些理解

    之前一直在想如果要在Unity3d上创建很多个具有相同结构的对象,是如何做的,后来查了相关资料发现预设体可以解决这个问题! 预设体的概念: 组件的集合体 , 预制物体可以实例化成游戏对象. 创建预设体 ...

  6. Unity3d入门 - 关于unity工具的熟悉

    上周由于工作内容较多,花在unity上学习的时间不多,但总归还是学习了一些东西,内容如下: .1 根据相关的教程在mac上安装了unity. .2 学习了unity的主要的工具分布和对应工具的相关的功 ...

  7. “.Net 社区虚拟大会”(dotnetConf) 2016 Day 3 Keynote: Scott Hanselman

    美国时间 6月7日--9日,为期三天的微软.NET社区虚拟大会正式在 Channel9 上召开,美国时间6.9 是第三天, Scott Hanselman 做Keynote.今天主题围绕的是.NET ...

  8. “.Net 社区虚拟大会”(dotnetConf) 2016 Day 2 Keynote: Miguel de Icaza

    美国时间 6月7日--9日,为期三天的微软.NET社区虚拟大会正式在 Channel9 上召开,美国时间6.8 是第二天, Miguel de Icaza 做Keynote,Miguel 在波士顿Xa ...

  9. “.Net 社区虚拟大会”(dotnetConf) 2016 Day 1 Keynote: Scott Hunter

    “.Net 社区虚拟大会”(dotnetConf) 2016 今天凌晨在Channel9 上召开,在Scott Hunter的30分钟的 Keynote上没有特别的亮点,所讲内容都是 微软“.Net社 ...

随机推荐

  1. Jquery Highcharts 参数配置说明

    chart: renderTo 图表的页面显示容器 defaultSeriesType 图表的显示类型(line,spline, scatter, splinearea bar,pie,area,co ...

  2. UVa 11825 (状压DP) Hackers' Crackdown

    这是我做状压DP的第一道题,状压里面都是用位运算来完成的,只要耐下心来弄明白每次位运算的含义,还是容易理解的. 题意: 有编号为0~n-1的n台服务器,每台都运行着n中服务,每台服务器还和若干台其他服 ...

  3. 点滴积累【SQL Server】---SQL语句操作约束

    说明: --主键约束(Primary Key constraint):要求主键列的数据唯一,并且不允许为空. --唯一约束(Unique Constraint):要求该列唯一,允许为空,但只能出现一个 ...

  4. 在asp.net前台页面中引入命名空间 和连接数据库

    例如:<%@ Import Namespace="System.Data" %> 连接数据库 <% string strconn = "Data Sou ...

  5. [转载] FFmpeg API 变更记录

    最近一两年内FFmpeg项目发展的速度很快,本来是一件好事.但是随之而来的问题就是其API(接口函数)一直在发生变动.这么一来基于旧一点版本的FFmpeg的程序的代码在最新的类库上可能就跑不通了. 例 ...

  6. HDU 4608 I-number 2013 Multi-University Training Contest 1

    定义一个数 y 为 x 的 I-number.对于 y 有如下要求: 1.y > x; 2.y 的每一位之和要为10的倍数(例如 28 每一位之和为 10 ,为 10 的 1 倍); 3.这样的 ...

  7. 定时组件quartz系列<二>quartz的原理

    Quartz是一个大名鼎鼎的Java版开源定时调度器,功能强悍,使用方便.   一.核心概念   Quartz的原理不是很复杂,只要搞明白几个概念,然后知道如何去启动和关闭一个调度程序即可.   1. ...

  8. 【转】MIPS交叉编译环境的建立

    原文网址:http://imgtec.eetrend.com/forum/2371 我觉得对于MIPS处理起来说最令新手头疼的应该就是编译环境的建立了,这点MIPS做的确实不是很好,不像ARM那样有许 ...

  9. Oracle RAC 负载均衡测试(结合服务器端与客户端)

    Oracle RAC 负载均衡使得从客户端发起的连接能够有效地分配到监听器负载较小的实例上.有两种方式实现客户端负载均衡,一是通过配置客户端的load_balance,一是通过配置服务器端的remot ...

  10. Markdown解决需要输入两个回车才能为一个空行的问题

    markdownDataDiv.children().each(function(){ $(this).html($(this).html().replaceAll("\n",&q ...