Unity3D 官方基础教程 Creating Scenes

来源:互联网 发布:奥运会男篮vs美国数据 编辑:程序博客网 时间:2024/04/30 03:28

Creating Scenes(创建场景)

Scenes contain the objects of your game. They can be used to create a main menu, individual levels, and anything else. Think of each unique Scene file as a unique level. In each Scene, you will place your environments, obstacles, and decorations, essentially designing and building your game in pieces.

场景包含了游戏中的所有物件,他们可以被用来创建主菜单,独立层等,我们可以把每个单一的场景文件当作独立层,在每个场景中,你可以构建游戏环境,放置障碍物,装饰物来逐步设计和创建整个游戏。

Instancing Prefabs(实例化预设)

Use the method described in the last section to create a Prefab. You can also read more details about Prefabs here. Once you've created a Prefab, you can quickly and easily make copies of the Prefab, called an Instance. To create an instance of any Prefab, drag the Prefab from the Project View to the Hierarchy or Scene View. Now you have a unique instance of your Prefab to position and tweak as you like.

按照上一部分的说明你可以创建一个预设。也可以在这了解更多关于预设的细节。一理创立了一个预设,可以迅速方便的制作预设的复制品,称做实例。创建任何预设的实例,可以把预设从项目视图中拖到层次和场景视图中,现在你可以创建 一个预设的实例来随意的移动和扭曲。

Adding Component & Scripts(添加组件和脚本)

When you have a Prefab or any GameObject highlighted, you can add additional functionality to it by using Components. Please view the Component Reference for details about all the different Components. Scripts are a type of Component. To add a Component, just highlight your GameObject and select a Component from the Componentmenu. You will then see the Component appear in the Inspector of the GameObject. Scripts are also contained in the Component menu by default.

If adding a Component breaks the GameObject's connection to its Prefab, you can always use GameObject->Apply Changes to Prefab from the menu to re-establish the link.

当你选中一个预制件或者动画对象时,你可以使用Component来增加它的功能,请看Component Reference来了解不同的Component的详细情况。脚本也是组件的一种,要增加组件时,仅需要选中物体,然后从组件菜单中选择一个组件即可,这时你可以看到添加的组件出现在游戏场景的监视视图中了,脚本被包含在默认组件菜单中。

如果添加一个组件破坏了游戏对象和预设件之间的关联,你始终可以通过菜单GameObject->Apply Changes to Prefab重新建立连接

Placing GameObjects(放置游戏对象)

Once your GameObject is in the scene, you can use the Transform Tools to position it wherever you like. Additionally, you can use the Transform values in the Inspector to fine-tune placement and rotation. Please view the Transform Component page for more information about positioning and rotating GameObjects.

一旦你的游戏对象在场景中,你可以使用变换工具来把它放到任何你喜欢的地方。此外,你可以在检视视图中使用Transform值来微调它的位置和旋转角度。查看更多关于定位和旋转游戏对象的信息Transform Component page

Working with Cameras(使用相机)

Cameras are the eyes of your game. Everything the player will see when playing is through one or more cameras. You can position, rotate, and parent cameras just like any other GameObject. A camera is just a GameObject with a Camera Component attached to it. Therefore it can do anything a regular GameObject can do, and then some camera-specific functions too. There are also some helpful Camera scripts that are installed with the standard assets package when you create a new project. You can find them in Components->Camera-Control from the menu. There are some additional aspects to cameras which will be good to understand. To read about cameras, view theCamera component page.

相机是游戏的眼睛。玩家看到的一切都是通过一个或多个摄像机播放的。你可以像其它游戏对象一样定位、旋转、及父处理摄像机。相机只是一个附加了相机组件的游戏对象。因此,它可以做任何普通游戏对象可以做的事情,并且还有一些相机特有的功能。还有一些有用的摄像机脚本,它们是在你创建一个新工程时随标准资源包一起安装的。你可以通过菜单Components->Camera-Control找到它们。要了解如何更好地使用相机,请查看Camera component page.

Lights(光源)

Except for some very few cases, you will always need to add Lights to your scene. There are three different types of lights, and all of them behave a little differently from each other. The important thing is that they add atmosphere and ambience to your game. Different lighting can completely change the mood of your game, and using lights effectively will be an important subject to learn. To read about the different lights, please view the Light component page.

除了一些极少数的情况,你总是需要为你的场景添加光源。有三种不同类型的光源,它们的表现有所不同,重要的是,它们能为你的游戏增加气氛和氛围,不同的光源可以完全改变你的游戏的情境,有效地利用光源将是一个重要的学习课题。要了解有关不同的光源,请查看Light component page.


原创粉丝点击