2 场景设置
2.1 本节效果预览
![](https://upload-images.jianshu.io/upload_images/9047377-b3159dd34a4458fd.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/906/format/webp)
2.2 项目目录设置
点击Project面板的Create按钮,在根目录下面新建wm文件夹
![](https://upload-images.jianshu.io/upload_images/9047377-7861e04189f88d00.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/232/format/webp)
Wm文件夹用于存放我们自己生成的Prefab和脚本等其他资源,主要是与Tanks项目原始资源和素材做区分.
Wm文件夹下面有三个子文件夹
![](https://upload-images.jianshu.io/upload_images/9047377-3790d05c2feeb90f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/89/format/webp)
Prefabs用于存放我们自己定义的预设体
Scenes用于存放我们的游戏场景
Scripts用于存放我们自己写的C#脚本
2.3 新建场景
点击菜单File -> New Scene新建一个场景,保存到Scenes下面,命名为s1
![](https://upload-images.jianshu.io/upload_images/9047377-f1424564751ded8c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/250/format/webp)
下面开始设置场景
首先删掉Hierarchy里面的Directional Light,因为素材里面自带了一个光源.
![](https://upload-images.jianshu.io/upload_images/9047377-b3dc4398ca15f880.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/234/format/webp)
2.4 添加LevelArt
在Project里面找到Prefabs/LevelArt
![](https://upload-images.jianshu.io/upload_images/9047377-1c671336a141556e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/504/format/webp)
这是我们的场景,将LevelArt拖放到Hierarchy里面
![](https://upload-images.jianshu.io/upload_images/9047377-2aee740533e6e679.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000/format/webp)
主要LevelArt中Transform组件的位置position,旋转rotation和缩放scale全部是如上图所示的默认值。如果不小心改动了,可以通过点击Inspector面板,Transform组件右上角的小齿轮打开下拉菜单
![](https://upload-images.jianshu.io/upload_images/9047377-999d0e8ff46bc137.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/279/format/webp)
可以使用Reset重置全部设置,也可以使用最下面的分别进行重置。
2.5 关闭自动渲染
我们添加了场景之后可以听到电脑在疯狂的运转,右下角还有进度条一直在跑。
![](https://upload-images.jianshu.io/upload_images/9047377-c13ca10cb1928aa7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/193/format/webp)
这是unity正在对光照进行实时渲染的运算,一般情况我们不需要这个一直进行。
我们可以通过Light面板进行设置。
![](https://upload-images.jianshu.io/upload_images/9047377-7bcaa035e8ef43d7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/624/format/webp)
取消 Auto前面的对勾,取消Baked GI前面的对勾,设置Realtime Resolution为0.5,将Reflection Source从Skybox改为Color,色值为(72,62,113),Hex值为#483e71
![](https://upload-images.jianshu.io/upload_images/9047377-06e6027862db8b16.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/738/format/webp)
设置完成之后点击右下角的Build
![](https://upload-images.jianshu.io/upload_images/9047377-b8db02fa47e1643b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/187/format/webp)
2.6 设置MainCamera
下面我们回到场景中,设置一下MainCamera
![](https://upload-images.jianshu.io/upload_images/9047377-55fa2cbd1b91e2a7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/277/format/webp)
坐标设置为(-43,42,-25)
旋转角度设置为(40,60,0)
![](https://upload-images.jianshu.io/upload_images/9047377-cdd77410a3db380e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/272/format/webp)
Clear Flags从Skybox改为Solid Color,Projection改为Orthpgraphic
背景颜色Background设置为(80,60,50)
![](https://upload-images.jianshu.io/upload_images/9047377-a75ba391c66d5ad7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/230/format/webp)
保存一下场景,本节内容到此完毕,下节开始添加坦克.
---------------------------我是目录分割线---------------------------
《杜增强讲Unity之Tanks坦克大战》4-坦克的移动和旋转
《杜增强讲Unity之Tanks坦克大战》9-发射子弹时蓄力
《杜增强讲Unity之Tanks坦克大战》11-游戏流程控制
---------------------------我是目录分割线---------------------------