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

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!

主站蜘蛛池模板: 龙门县| 手游| 宁波市| 樟树市| 南昌县| 克什克腾旗| 鲁甸县| 荆州市| 琼中| 湖口县| 丹凤县| 赤峰市| 永仁县| 句容市| 裕民县| 临泉县| 惠来县| 祁连县| 固阳县| 泗阳县| 武冈市| 吴忠市| 康保县| 亳州市| 镇康县| 江达县| 三亚市| 石首市| 涡阳县| 屯留县| 木里| 夏河县| 恩平市| 台山市| 芜湖县| 柏乡县| 长子县| 金塔县| 湄潭县| 贺州市| 泰来县|