官术网_书友最值得收藏!

Building the project

Of course, before building your project, it is a good idea to save it. If you click on Save or use the Ctrl+S key combination, Unity will ask you to save your scene. A scene is a collection of objects laid out in a 3D world. In our case, this is the collection containing the light source, the camera, and our sphere. Just give your scene a name, I used main and placed that in the subfolder Scenes under Assets (which is the default).

When you have saved your project, we can start to build the code. However, before we do that, we have to tell Unity that we are working on a Windows Holographic application. To do that, do the following:

  1. Go the File | Build Settings or press Ctrl + Shift + B.
  2. In the dialog you see now, press the Add open scenes button. This makes sure that our current scene is part of the package.
  3. In the platform selection box, we can choose for which platform we would like to build our app. As you can see, there is quite a large choice of platforms, but we will choose Windows Store and then click on the Switch Platform button. You can tell we now have this platform as the default by the appearance of the Unity logo behind the Windows Store option.
  4. On the right-hand side, we can set specific Windows Store options.
  5. SDK: Windows 10.
  6. UWP Build Type: D3D (meaning DirectX 3D).
  7. Build and Run does not matter here; we can leave that.
  8. Check Unity C# Projects.
  9. Check Development Build.
Unity Build Settings for HoloLens
  1. Now, before we press Build, we need to do one more thing--click on the Player Settings... button. This is where you set the properties for the Unity Player, thus the application that loads the scenes and performs the animations, interactions, and so on. We, however, do not use the Unity Player but use our own. Still, we need to set one very important property:
  2. Click on Player Settings, and see that the Inspector changes.
  3. Click on Other Settings.
  4. Check Virtual Reality Supported and verify that the Virtual Reality SDK contains Windows Holographic. This makes sure that we have two cameras when we run the app.
  5. Now, we can press Build. Unity will ask us for a place to put the C# and Visual Studio files. I usually create a folder in the current folder with the name App. Press Select Folder and Unity will build the code for us.

The first time you do this, you will notice this takes some time. It has to generate quite a lot of files, and it needs to package up all our assets. The next time only the changes need to be processed, so it will be much quicker.

When the building is done, Unity will open an Explorer window where our project is. You will see the newly created App folder. If you open that, you will find the .sln file, in my case HelloHoloOnUnity.sln. This is a Visual Studio solution file we can open in Visual Studio. Let's do this!

主站蜘蛛池模板: 迭部县| 永康市| 田东县| 防城港市| 洪江市| 新建县| 栾城县| 景洪市| 正定县| 临安市| 北川| 罗平县| 克东县| 拉孜县| 沽源县| 仁寿县| 巢湖市| 乡宁县| 黄冈市| 潞西市| 土默特左旗| 香格里拉县| 古浪县| 稷山县| 宜君县| 丁青县| 建水县| 翁源县| 高要市| 宜丰县| 遂昌县| 横峰县| 房产| 北宁市| 阜康市| 康马县| 凤山县| 泗阳县| 黔南| 马尔康县| 星座|