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論壇.你可以提問,分享項目,構建團隊等.當然只是要訪問論壇一次,因爲我們想看到你製作的令人吃驚的遊戲.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章