查看: 2184|回复: 0
打印 上一主题 下一主题

[Unity 组件参考手册]组件:游戏对象组件之游戏对象

[复制链接]
.    

3797

主题

11

听众

5万

积分

首席设计师

Rank: 8Rank: 8

纳金币
32328
精华
41

活跃会员 优秀版主 荣誉管理 论坛元老

跳转到指定楼层
楼主
发表于 2013-1-30 20:30:02 |只看该作者 |倒序浏览
GameObjects are containers for all other Components. All objects in your game are GameObjects that contain different Components. Technically you can create a Component without GameObject, but you won't be able to use it until you apply it to a GameObject.游戏对象是所有其他组件的容器。在你的游戏中的所有物体都是包含不同组件的游戏对象。从技术角度来讲,你可以不依赖游戏对象创建一个组件,但您将无法使用它,直到你将它应用到一个游戏对象。  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
    计算遮挡剔除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/
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-11-29 07:14 , Processed in 0.088103 second(s), 33 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部