Unity3D说明文档翻译-Publishing Builds

Publishing Builds

构建项目发行

At any time while you are creating your game, you might want to see how it looks when you build and run it outside of the editor as a standalone or web player. This section will explain how to access the Build Settings and how to create different builds of your games.

在创建你的游戏的过程中,当你构建并在编辑器外以一个单机或网络游戏运行时你会想知道它看起来如何.这节将说明如何访问构建设置和如何创建你的游戏的不同构建.

File->Build Settings… is the menu item to access the Build Settings window. It pops up an editable list of the scenes that will be included when you build your game.

文件>构建设置是访问构建设置窗口的菜单项.当你构建游戏时它弹出一个将要包含的场景的可编辑列表.

The Build Settings window

构建设置窗口

 

The first time you view this window in a project, it will appear blank. If you build your game while this list is blank, only the currently open scene will be included in the build. If you want to quickly build a test player with only one scene file, just build a player with a blank scene list.

在你第一次在项目中浏览此窗口时它将显示空白.如果你构建你的游戏而此列表又是空白的,只有当前打开的场景包含在构建内.如果你项快速构建一个只有一个场景文件的测试,只需构建一个带空场景列表的游戏.

It is easy to add scene files to the list for multi-scene builds. There are two ways to add them. The first way is to click the Add Open Scenes button. You will see the currently open scenes appear in the list. The second way to add scene files is to drag them from the Project View to the list.

很容易添加场景文件到列表作为多场景构建.有两种方式添加它们.第一种方法是单击打开场景按钮.你将看到你将看到当前打开场景出现在列表上.第二种方式是添加场景文件,从项目视图列表拖拽它们到此.

At this point, notice that each of your scenes has a different index value. Scene 0 is the first scene that will be loaded when you build the game. When you want to load a new scene, useApplication.LoadLevel() inside your scripts.

此时,注意你的每个场景有不同的索引值.场景0是当你构建游戏时第一个加载的场景.当你想加载一个新场景在你的脚本里使用Application.LoadLevel()函数.

If you’ve added more than one scene file and want to rearrange them, simply click and drag the scenes on the list above or below others until you have them in the desired order.

如果你已经添加多个场景文件并想重新排列它们,只需点击和拖拽场景在列表上向上或向下直到你满意的顺序.

If you want to remove a scene from the list, click to highlight the scene and press Command-Delete. The scene will disappear from the list and will not be included in the build.

如果你想从列表移除一个场景,点击高亮此场景并按cmd+delete键.场景将从列表消失,不再包含在构建内.

When you are ready to publish your build, select a Platform and make sure that the Unity logo is next to the platform; if its not then click in the Switch Platform button to let Unity know which platform you want to build for. Finally press the Build button. You will be able to select a name and location for the game using a standard Save dialog. When you click Save, Unity builds your game pronto. It’s that simple. If you are unsure where to save your built game to, consider saving it into the projects root folder. You cannot save the build into the Assets folder.

当你准备发行你的构建,选择一个平台并确认Unity标志在此平台旁,如果没有则点击切换平台按钮让Unity知道哪个平台是你想创建到的.最后按构建按钮.你也可以在标准保存对话框内选择一个名称和位置给你的游戏.当你单击保存,Unity会很快构建你的游戏.如此简单.如果你不确定你的游戏构建要保存到哪,可考虑保存到项目根目录.你不能保存构建到资源文件夹.

Enabling the Development Build checkbox on a player will enable Profiler functionality and also make the Autoconnect Profiler and Script Debugging options available.

在一个游戏中勾选开发构建复选框将激活分析器功能并让自动连接分析器和脚本调试功能可用.

Further information about the Build Settings window can be found on the Build Settings page.

更多关于构建设置窗口的信息可在构建设置页面查找.

Building standalone players

构建单机游戏

With Unity you can build standalone applications for Windows, Mac and Linux. It’s simply a matter of choosing the build target in the build settings dialog, and hitting the ‘Build’ button. When building standalone players, the resulting files will vary depending on the build target. For the Windows build target, an executable file (.exe) will be built, along with a Data folder which contains all the resources for your application. For the Mac build target, an app bundle will be built which contains the file needed to run the application as well as the resources.

你可以用Unity构建Windows,Mac和Linux单机程序.这仅仅是在构建设置对话框选择构建目标再点击构建的问题.当构建单机游戏时,生成文件将非常依赖构建目标.在Windows上一个可执行文件(.exe)将被创建,并带有一个包含所有你程序资源的Data文件夹.在Mac上一个包含程序需要运行的文件的app包将被创建.

Distributing your standalone on Mac is just to provide the app bundle (everything is packed in there). On Windows you need to provide both the .exe file and the Data folder for others to run it. Think of it like this: Other people must have the same files on their computer, as the resulting files that Unity builds for you, in order to run your game.

Mac上发布你的单机程序只需提供app包(所有东西都装在里面).在Windows上你需要提供.exe文件和Data文件夹给其他人运行它.考虑到像这样:其他人必须有相同的文件在他们的电脑上,就是Unity构建给你的生成文件,以便运行你的游戏.

Inside the build

内部构建进程

The building process will place a blank copy of the built game application wherever you specify. Then it will work through the scene list in the build settings, open them in the editor one at a time, optimize them, and integrate them into the application package. It will also calculate all the assets that are required by the included scenes and store that data in a separate file within the application package.

构建进程将放置一个构建游戏程序空白拷贝到你指定的地方.然后它将通过在构建设置内的场景列表工作,在编辑器内每次打开一个场景,优化它们,并把它们集成到一个应用程序包.它还将计算所有所需资源包括场景和存储了分离文件数据的程序包.

· 

Any GameObject in a scene that is tagged with ‘EditorOnly’ will not be included in the published build. This is useful for debugging scripts that don’t need to be included in the final game.

 

场景内任何标记为仅用于编辑器的游戏对象将不会包含在发行构建中.这对无需包含在最终游戏内的调试脚本很有用.

· 

When a new level loads, all the objects in the previous level are destroyed. To prevent this, useDontDestroyOnLoad() on any objects you don’t want destroyed. This is most commonly used for keeping music playing while loading a level, or for game controller scripts which keep game state and progress.

 

当一个新层级加载,所以之前层级的对象将销毁.要阻止这样,使用DontDestroyLoad()函数到任何你不想销毁的对象上.这最常用于当加载一个层级保持音乐播放,或用于游戏控制器脚本保持游戏状态和进展.

· 

After the loading of a new level is finished, the message: OnLevelWasLoaded() will be sent to all active game objects.

 

    当加载一个层级结束,消息--OnLevelLoaded()将发送给所有活跃游戏对象.

 

For more information on how to best create a game with multiple scenes, for instance a main menu, a high-score screen, and actual game levels, check our Tutorials.

 

更多关于如何最佳的创建一个多场景游戏的信息,如主菜单,高分屏幕和真实游戏层级等,查看我们的教程.

Preloading

预先加载

Published builds automatically preload all assets in a scene when the scene loads. The exception to this rule is scene 0. This is because the first scene is usually a splashscreen, which you want to display as quickly as possible.

当场景加载发行构建将自动预先加载所有资源到场景内.例外是场景0.这是因为第一个场景通常是闪烁屏幕,你想要显示的尽可能快.

To make sure all your content is preloaded, you can create an empty scene which calls Application.LoadLevel(1). In the build settings make this empty scene’s index 0. All subsequent levels will be preloaded.

为确保所以你的内容都加载了,你可以创建一个空场景,调用Application.LoadLevel(1)函数.在构建设置上使空场景的索引为0.所以后来的层级都将被预先加载.

You’re ready to build games

你准备去构建游戏

By now, you have learned how to use Unity’s interface, how to use assets, how to create scenes, and how to publish your builds. There is nothing stopping you from creating the game of your dreams. You’ll certainly learn much more along the way, and we’re here to help.

现在你已经学习了如何使用Unity的界面,如何使用资源,如何创建场景,和如何发布你的构建.没有任何事情能阻止你创建游戏的梦想.你将沿着这条路学习更多,我们会在这里帮助你.

To learn more about constructing game levels, see the section on Building Scenes.

学习更多关于构造游戏层级,参考章节构建场景.

To learn more about Scripting, see the Scripting Section.

学习更多关于脚本编辑,查看脚本编辑章节.

To learn more about creating Art and importing assets, see Assets Workflow of the manual.

学习更多关于创建艺术和导入资源,查看手册的资源工作流.

To interact with the community of Unity users and developers, visit the Unity Forums. You can ask questions, share projects, build a team, anything you want to do. Definitely visit the forums at least once, because we want to see the amazing games that you make.

Unity用户和开发者社区交流,访问Unity论坛.你可以提问,分享项目,构建团队等.当然只是要访问论坛一次,因为我们想看到你制作的令人吃惊的游戏.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值