为方便初学者尽快结合该书提供的示例进行学习,本文描述了如何用Unity导入这些工程并实际运行

本文执行的相关环境

  • Win10专业版
  • Unity5.3.2p1

    准备工作

  • 下载Unity

    • 到Unity官方网站找到下载链接(随着Unity官方网页更新,后续该url可能会发生变化,请读者自行查找相应版本) enter image description here
  • 下载随书源码

    • (略)

      开始导入

  • 解压源码到合适位置 enter image description here

  • 导入Chapter0的示例
    1. 打开Chapter0文件夹可以看到如下文件结构,标红线的内容正是Unity的工作区数据 enter image description here
    2. 启动Unity,点击Open enter image description here
    3. 选择相应工程文件夹,注意选中的文件夹下务必要有Assets目录 enter image description here
    4. 正常情况下此时能看到如下画面 enter image description here
    5. 点击Assets文件夹下的Scene(Unity是以“场景”为单位组织游戏的,开发时要选择相应的场景) enter image description here
    6. 可以看到工程中的场景,双击选择一个 enter image description here
    7. 打开场景后可以看到如下画面,点击上方的三角形按钮即可启动游戏 enter image description here
    8. 在游戏运行时,点击屏幕方块将跳起 enter image description here
    9. 至此,我们就成功地导入一个示例了。
  • 载入Chapter1的示例
    1. 重新打开Unity,在启动屏上点击OPEN enter image description here
    2. 按下图选择相应的文件夹 enter image description here
    3. 选取正确的启动场景 enter image description here enter image description here enter image description here
    4. 这样,我们就完成了chapter1的示例载入
  • 其余各章节的载入基本遵循同样的流程,故不再赘述。如有不明之处,请读者留言指出。 (完)