GameObjects
来源:互联网 发布:农村淘宝的网址是什么 编辑:程序博客网 时间:2024/05/16 23:41
What are GameObjects?
Every object in your game is a GameObject. However, GameObjects don't do anything on their own. They need special properties before they can become a character, an environment, or a special effect. But every one of these objects does so many different things. If every object is a GameObject, how do we differentiate an interactive power-up object from a static room? What makes these GameObjects different from each other?
The answer to this question is that GameObjects are containers. They are empty boxes which can hold the different pieces that make up a lightmapped island or a physics-driven car. So to really understand GameObjects, you have to understand these pieces; they are called Components. Depending on what kind of object you want to create, you will add different combinations of Components to the GameObject. Think of a GameObject as an empty cooking pot, and Components as different ingredients that make up your recipe of gameplay. You can also make your own Components using Scripts.
The GameObject-Component Relationship
As described on the GameObjects page, a GameObject contains Components. We'll explore this relationship by discussing a GameObject and its most common Component -- the Transform Component. With any Unity Scene open, create a new GameObject (using on Windows or on Mac), select it and take a look at the Inspector.
The Inspector of an Empty GameObject
Notice that an empty GameObject still contains a Name, a Tag, and a Layer. Every GameObject also contains a Transform Component.
The Transform Component
It is impossible to create a GameObject in Unity without a Transform Component. The Transform Component is one of the most important Components, since all of the GameObject's Transform properties are enabled by its use of this Component. It defines the GameObject's position, rotation, and scale in the game world/Scene View. If a GameObject did not have a Transform Component, it would be nothing more than some information in the computer's memory. It effectively would not exist in the world.
The Transform Component also enables a concept called Parenting, which is utilized through the Unity Editor and is a critical part of working with GameObjects. If you would like to learn more about the Transform Component and Parenting, please read the Transform Component Reference page.
Other Components
The Transform Component just happens to be critical to all GameObjects, so each GameObject has one. But GameObjects can contain other Components as well.
The Main Camera, added to each scene by default
Taking a look at the Main Camera GameObject, we can see that it contains a different collection of Components. Specifically, a Camera Component, a GUILayer, a Flare Layer, and an Audio Listener. All of these Components provide additional functionality to the GameObject. Without them, there would be nothing rendering the graphics of the game for the person playing! Rigidbodies, Colliders, Particles, and Audio are all different Components (or combinations thereof) that can be added to any given GameObject.
- GameObjects
- differences between active GameObjects inactive GameObjects
- Unity3d教程游戏目标 (GameObjects)停用游戏目标 (GameObjects)
- Unity3D说明文档翻译-GameObjects
- Unity3D说明文档翻译-Positioning GameObjects
- Unity3D说明文档翻译-Deactivating GameObjects
- Unity3D说明文档翻译-Static GameObjects
- Unity3d入门教程构建场景 (Building Scenes)>游戏目标 (GameObjects)
- 【笔记】Core GameObjects, components, and concepts relating to Unity UI development include
- Qt4.5.1触摸屏(tslib 1.4)+sqlite3 移植全记录
- POJ2352 Stars 一维树状数组 更新节点,查询区域
- Qt4.5.1触摸屏(tslib 1.4)+sqlite3 移植全记录
- Qt4.5.1触摸屏(tslib 1.4)+sqlite3 移植全记录
- NEMA0183数据格式
- GameObjects
- fck2.5应用
- Mysql实现基于时间点的恢复
- 软件调试笔记
- 虚拟机中左键不能使用,鼠标滑轮和右键正常-解决方案
- 告别cpp&h:hpp文件编写心得
- ZZ java path,class path的概念解析
- asp.net 扩展解决共享两个网站的图片问题
- ASM 重新部署