spotlight
On the Spotlight Team, we work with the most ambitious Unity developers to try to push the boundary of what a Unity game can be. We see all sorts of innovative and brilliant solutions for complex graphics, performance, and design problems. We also see the same set of issues and solutions coming up again and again.
在Spotlight小组中,我们与雄心勃勃的Unity开发人员一起努力扩大Unity游戏的界限。 对于复杂的图形,性能和设计问题,我们看到了各种各样的创新和出色的解决方案。 我们还会看到同样的问题和解决方案不断出现。
This blog series looks at some of the most frequent problems we encounter while working with our clients. These are lessons hard won by the teams we have worked with, and we are proud to be able to share their wisdom with all our users.
本博客系列介绍了与客户合作时遇到的一些最常见的问题。 这些是我们与之合作的团队所赢得的经验教训,我们为能够与所有用户分享他们的智慧而感到自豪。
Many of these problems only become obvious once you are working on a console or a phone, or are dealing with huge amounts of game content. If you take these lessons into consideration earlier in the development cycle, you can make your life easier and your game much more ambitious.
这些问题中的许多问题只有在您使用控制台或电话或处理大量游戏内容时才会变得明显。 如果您在开发周期的早期就考虑了这些教训,则可以使您的生活更轻松,游戏也更具野心。
资料夹结构 (Folder structure)
Before you add your first camera, map out your first town, or even get a cube spinning, take a moment to think about the folder structure of your project. While the project view does a very admirable job of making your game data easily searchable, searching isn’t always practical. Ideally, you want a folder structure that guides your teammates to the correct place even when they have no idea what to search for.
在添加第一台摄像机,绘制第一个城镇的地图,甚至旋转立方体之前,请花点时间考虑一下项目的文件夹结构。 尽管项目视图在使您的游戏数据易于搜索方面做得非常令人钦佩,但是搜索并不总是可行的。 理想情况下,您需要一个文件夹结构,即使您的队友不知道要搜索什么内容,也可以将其引导到正确的位置。
There are lots of ways to do this, and I will give some examples of things we have seen work well. But, really, use whatever works for you. If your project layout has good answers for the following questions, it is probably a pretty good layout.
有很多方法可以做到这一点,我将举例说明我们看到的效果很好的事情。 但是,实际上,请使用对您有用的任何东西。 如果您的项目布局对以下问题有很好的答案,则可能是一个很好的布局。
- Who made this? Is this something your team made, or something you bought? 是谁做的? 这是您的团队生产的东西,还是您购买的东西?
- What type of thing is this? Script, Audio, Art, Design? You want to be able to see a problem in game and track down the data. 这是什么类型的东西? 脚本,音频,艺术,设计? 您希望能够看到游戏中的问题并跟踪数据。
- What area of the game does this cover? Is it in a specific level, all over the place, or only used in the launch screen? This makes it easy to know how expensive a given asset should be, and how much other data you might need to touch if you change it. 该游戏涵盖哪些领域? 是在整个地方的特定级别,还是仅在启动屏幕中使用? 这使您很容易知道给定资产的价格,以及如果更改资产可能需要触摸多少其他数据。
- Is data coherent? Is a prefab or a character near the model that it comes from or the animation clips that go with it? 数据是否连贯? 预制件或角色是否在其所来自的模型或随之而来的动画片段附近?
Some examples:
一些例子:
Floating folders
浮动文件夹
-
Prepend all folder names for your own assets with an _.
在您自己的资产的所有文件夹名称前添加_。
- This causes them to sort on top of anything else. 这导致它们排序于其他任何事物之上。
- Personally, I like my Scene folder on top, so it gets two (i.e. __Scenes). 就个人而言,我最喜欢我的Scene文件夹,因此它有两个(即__Scenes)。
- Anything you get from the Asset Store just installs wherever it would like. 您从资产商店获得的任何东西都可以安装在任何需要的地方。
- If you majorly change an Asset Store purchase, stick the _ on the folder names and you will know not to overwrite with a newer version. 如果您主要更改资产商店的购买,请将_标记在文件夹名称上,您将知道不会覆盖较新的版本。
Divide and conquer
分而治之
- Put everything you get from the Asset Store in an AssetStore sub-folder. 将您从资产商店获得的所有内容放在AssetStore子文件夹中。
- You will need to fix up anything that uses hardcoded paths. 您将需要修复所有使用硬编码路径的内容。
- This keeps your Asset Folder under your control, and keeps things as neat as possible 这将使您的资产文件夹处于您的控制之下,并使内容保持尽可能整洁
Per-discipline top level folders
每个学科的顶级文件夹
- Every work group gets its own folder. Level Design. System Design. Environment Art. Character Art. 每个工作组都有自己的文件夹。 关卡设计。 系统设计。 环境艺术。 角色艺术。
- Good for large teams. 适合大型团队。
- Keeps content you produced in easily recognized folders. 将您制作的内容保存在易于识别的文件夹中。
- Locally coherent data. Things should live near where they are referenced. 本地一致的数据。 事物应该住在它们被引用的地方附近。
与资产商店配套 (Living with Asset Store packages)
For larger teams with longer projects it is very easy to have assets from the Asset Store start to bloat a project. The brilliant developers who put tools up on the Asset Store try very hard to make their tools easy to learn. This often means including large tutorial and sample projects with the assets to support them.
对于具有较长项目的较大团队,资产库中的资产开始膨胀项目非常容易。 出色的开发人员在Asset Store上放置了工具,他们努力使工具易于学习。 这通常意味着包括大型的教程和示例项目,以及支持它们的资产。
The easiest way to handle Asset Store bloat that we have found, is to avoid importing large asset store packages directly into your project. Rather, import your large packages into a new project. You can then delete any heavy content you don’t need before moving what you need over to your project. You can clean up any assets you don’t need, organize the asset package how you would like it, and then package this up in a new package using the “Assets->Export Package…” dialog.
我们发现处理资产商店膨胀的最简单方法是避免将大型资产商店软件包直接导入您的项目。 而是将大型软件包导入到新项目中。 然后,您可以删除不需要的任何繁重内容,然后再将所需内容移到项目中。 您可以清理不需要的任何资产,按照自己的意愿组织资产包,然后使用“资产->出口包…”对话框将其打包为新包。
Make sure that you check both the original version and your modified version into whatever source control you use, just in case you need to later update your Asset Store purchase or if anything goes wrong.
确保将原始版本和修改后的版本都检查到所使用的任何源代码管理中,以防万一您日后需要更新您的Asset Store购买或出现任何问题时使用。
Unity版本 (Unity Versions)
The image below is my current desktop. Given the number of client projects I work on, I always have 5+ versions of Unity installed, not counting the 1-3 I have recently built from source code.
下图是我当前的桌面。 鉴于我从事的客户项目数量众多,我始终安装了5个以上版本的Unity,这还不包括我最近从源代码构建的1-3个版本。
If you use external source control — git, hg, perforce, etc. — I strongly recommend adding the version of Unity you use. Ideally, every branch of your game contains the project folder and, next to it, the version of Unity used to work on that project. As your team grows this will streamline onboarding, ease the Unity upgrade process, and make me very happy if you ever end up working with the Spotlight Team.
如果您使用外部源代码管理-git,hg,perforce等-我强烈建议添加您使用的Unity版本。 理想情况下,游戏的每个分支都包含项目文件夹,并在其旁边包含用于该项目的Unity版本。 随着您团队的成长,这将简化入门流程,简化Unity升级过程,并且如果您最终与Spotlight团队合作,会让我感到非常高兴。
初始项目设置 (Initial Project Settings)
There are quite a few project settings that are easy to overlook when you are just starting up a new project. Tucked away in their own menu, generally far from whatever problem you are trying to solve, it is very easy to forget all about the myriad controls we give over your project. So, here is a quick lightning bonus round of the most commonly overlooked settings, in menu order.
在启动新项目时,有很多项目设置很容易忽略。 隐藏在自己的菜单中,通常与您要解决的任何问题都相去甚远,很容易忘记我们为项目提供的无数控件的所有信息。 因此,这是按菜单顺序排列的最常被忽略的设置的快速闪电奖金回合。
Audio
音讯
- Disable Unity Audio – If you aren’t planning on using Unity’s built-in audio, disable it here. This will remove some overhead with no cost. 禁用Unity音频–如果您不打算使用Unity的内置音频,请在此处禁用它。 这将免费节省一些开销。
Time
时间
- Fixed Timestep – If you are not making heavy use of Joints or stacking RigidBodies, you should set this to match your target time per frame, or 1 / target framerate. 固定时间步长–如果您不大量使用关节或堆叠刚体,则应将其设置为与每帧目标时间匹配,或与目标帧速率匹配1 /。
- Maximum Allowed Timestep – This is the largest number that will ever be passed into deltaTime. I generally set this at around 0.1f, or 10 fps. If your game is running lower than 10 fps, generally speaking, it is better to go into slow motion until you recover. This will help you out when your game gets big if you start having one frame lag spikes, especially while loading in the editor. 最大允许时间步长–这是有史以来传递给deltaTime的最大数字。 我通常将其设置为约0.1f或10 fps。 一般来说,如果您的游戏运行速度低于10 fps,则最好进入慢动作,直到恢复。 如果您开始遇到一帧延迟尖峰,尤其是在编辑器中加载时,这将在您的游戏变大时为您提供帮助。
Player
播放器
-
Other Settings -> Rendering
其他设置->渲染
- Color Space – You want this to be Linear in almost all cases. It works with a wider array of Post Effects. 色彩空间–在几乎所有情况下,您都希望它是线性的。 它可以与更广泛的后期效果一起使用。
- GPU Skinning and Graphics Jobs – Set both of these to true. These settings both improve performance at the cost of some compatibility. By starting with these settings on, you can make sure each piece of content is compatible with them. Many projects run into issues trying to enable these to save performance late in development, when the cost for fixing data issues is high. GPU外观和图形作业–将两者都设置为true。 这些设置都以一些兼容性为代价来提高性能。 通过启用这些设置,可以确保每个内容都与它们兼容。 当解决数据问题的成本很高时,许多项目都遇到了问题,试图使这些问题在开发后期节省性能。
Physics
物理
- Default Solver Iterations – Like Fixed Timestep above, this improves the stability of complex physics systems. If you are not planning on using a lot of Rigidbodies, you can set this value to 1. 默认求解器迭代–与上面的固定时间步长一样,这提高了复杂物理系统的稳定性。 如果您不打算使用大量刚体,则可以将此值设置为1。
Quality
质量
-
Anti Aliasing – If you intend to use an anti aliasing solution from the Asset Store, or any of the ones included in our post processing stack, you will want to disable the default multi sampling anti aliasing.
抗锯齿–如果您打算使用Asset Store中的抗锯齿解决方案,或者使用我们后期处理堆栈中包含的任何解决方案,则需要禁用默认的多采样抗锯齿。
- V Sync Count – If your target framerate is 30, you should set this to Every Second V Blank. If you are having issues with your framerate falling lower than 30 during development, you should set this to Don’t Sync. 垂直同步计数–如果目标帧速率为30,则应将其设置为“每秒第二个空白”。 如果在开发过程中遇到帧率低于30的问题,则应将此设置为“不同步”。
Editor
编辑
- Version Control – Set this to match your source control. If you are not using source control, I still recommend using Visible Meta Files so you can inspect them if necessary. 版本控制–进行设置以匹配您的源代码控制。 如果您没有使用源代码管理,我仍然建议您使用可见元文件,以便在必要时进行检查。
- Asset Serialization – Set this to force text. It increases the overall size of your project, but allows you to diff changes, inspect assets, and gives more control over what Unity is doing. It does not affect build times or the final built executable in any way. 资产序列化–将此设置为强制文本。 它增加了项目的总体规模,但允许您进行更改,检查资产并更好地控制Unity的工作。 它不以任何方式影响构建时间或最终构建的可执行文件。
If your plan is to grow your game into something truly ambitious, taking a moment to set up your project correctly from the word go will save you a ton of time down the road. Our next blog will be a little bit different. We will be sharing several small editor tools written in-house that will hopefully improve your productivity and show you how to customize Unity yourself.
如果您打算将您的游戏发展成一个真正的野心,那么花点时间用go一词正确地设置您的项目将为您节省大量的时间。 我们的下一个博客将有所不同。 我们将分享一些内部编写的小型编辑器工具,这些工具有望提高您的生产率并向您展示如何自定义Unity。
翻译自: https://blogs.unity3d.com/2017/08/10/spotlight-team-best-practices-project-setup/
spotlight