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

The role of Visual Studio in developing for the HoloLens

You might have noticed another RockOn.sln file in the top-level folder. If you open that solution, you will see that it is empty. It contains no projects at all. The reason for this is that this solution will be a place for Unity to store all C# scripts that we will write. However, these scripts are not to be compiled in Visual Studio--it will not know how to deal with them. When we build our project in Unity, it creates a new RockOn.sln file in the VS folder. That is the one we need to open.

Later, when we add scripts to our app, you will see that the scripts are copied to the new VS folder as well. That's where we will edit them, debug them, and build them. So, this is the workflow:

  1. Add objects and scripts to the Unity project.
  2. Build the Unity project for the first time, giving it a unique folder.
  3. Open the newly created .sln file in that new folder in Visual Studio.
  4. Now, when you add scripts in Unity, rebuild the Unity project, leaving Visual Studio open in the background.
  5. Go to Visual Studio and you will get the familiar Files have changed; do you want to reload dialog. Click Yes.
  6. Edit the files in Visual Studio and verify in Unity that they are changed as well.

If you double-click a script file in Unity, it will open another instance of Visual Studio to edit it. That is a waste of resources--the procedure I described earlier works more quickly and is more memory-efficient.

Now, open the RockOn.sln file in the VS folder. Note the folder structure we already described before; it should look like this:

The Solution Explorer for our new project

We can build and deploy it now, but that will result in an empty scene, which I think is pretty boring, so it's time to add some items here.

主站蜘蛛池模板: 德安县| 金平| 大厂| 石景山区| 吉水县| 康定县| 郸城县| 金湖县| 三亚市| 琼结县| 汉阴县| 拉萨市| 娱乐| 靖安县| 泸西县| 清苑县| 登封市| 元谋县| 申扎县| 桑日县| 孝感市| 江山市| 铁岭市| 龙门县| 科技| 长沙市| 嫩江县| 高州市| 阳曲县| 格尔木市| 宁武县| 宝山区| 六枝特区| 正宁县| 宁晋县| 乌兰察布市| 凯里市| 县级市| 克拉玛依市| 平谷区| 江孜县|