- 最后登录
- 2018-12-19
- 注册时间
- 2012-8-20
- 阅读权限
- 90
- 积分
- 54706
- 纳金币
- 32328
- 精华
- 41
|
GameObjects are containers for all other Components. All objects in your game are inherently GameObjects.游戏对象是所有其他组件的容器。在你的游戏中的所有物体都是游戏对象。An empty GameObject 一个空的游戏对象
[Creating GameObjects 创建游戏对象]GameObjects do not add any characteristics to the game by themselves. Rather, they are containers that hold Components, which implement actual functionality. For example, a Light is a Component which is attached to a GameObject.游戏对象被添加到游戏中时本身并不包含任何特性(特征,属性..)。当然,它们包含有已经被实现的控制组件。例如,一个灯光(Light)就是一个添加到游戏对象的组件。If you want to create a Component from script, you should create and empty GameObject and then add required Component using gameObject.AddComponent(ClassName) function. You can't create Component and then make a reference from object to it.如果你想使用脚本创建一个组件,你需要创建一个空的游戏对象然后使用gameObject.AddComponent(ClassName)方法(函数)。你不可以创建一个组件然后通过引用赋予物体。From scripts, Components can easily communicate with each other through message sending or the GetComponent(TypeName) function. This allows you to write small, reusable scripts that can be attached to multiple GameObjects and reused for different purposes.使用脚本,组件间可以轻易的通过发送消息或者使用GetComponent(TypeName)方法相互沟通。
[Details 细节]Aside from being a container for the components, GameObjects have a Tag, a Layer and a Name.游戏对象除了被当做各个组件的容器外,它还拥有Tag(标签),Layer(层)和Name(名称)属性。Tags are used to quickly find objects, utilizing the Tag name. Layers can be used to cast rays, render, or apply lighting to certain groups of objects only. Tags and Layers can be set with the Tag Manager, found in Edit->roject Settings->Tags.Tag(标签)用途在于使用标签名来快速寻找物体,层可以用于投射射线,渲染或者对特定的一组物体单独应用光照。标签和层可以通过Tag Manager(标签管理器)进行设置,此选项可以通过 Edit->roject Settings->Tags找到。
[Static Checkbox 静态复选框]In Unity, there is a new checkbox in the GameObject called Static. This checkbox is used for:在Unity中,游戏对象有了一个新的选择框"Static",这个选项的用途在于: preparing static geometry for automatic batching
为自动烘焙准备静态的几何体
calculating Occlusion Culling
计算遮挡剔除calculating Occlusion Culling 计算遮挡剔除The Static checkbox is used when generating Occlusion data
当产生遮挡数据时,使用static选项When generating Occlusion data, marking a GameObject as Static will enable it to cull (or disable) mesh objects that cannot be seen behind the Static object. Therefore, any environmental objects that are not going to be moving around in your scene should be marked as Static.当产生闭塞数据时,设置游戏对象为Static将会剔除(或禁用)网格对象当这些部分被静态物体挡住而不可见时。因此,在你的场景中的所有不会动的物体都应该标记为Static。For more information about how Occlusion Culling works in Unity please read the Occlusion Culling page.如果想知道更多关于Unity中Occlusion Culling的信息请参阅 Occlusion Culling页面。
[Hints 提示] For more information see the GameObject scripting reference page.
查看"游戏对象脚本参考页"获取更多信息
More information about how to use layers can be found here.
更多关于层的信息可以在"这里"找到
More information about how to use tags can be found here.
更多关于如何使用标签的信息可以在"这里"找到
【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/ |
|